Form in two columns

Form in two columns

nskwortsownskwortsow Posts: 120Questions: 0Answers: 0
edited November 2012 in Editor
Hi,
I have a long form with 10+ fields. Currently, it scrolls inside the modal.
How can I break the form into two columns (label+field|label+field)?
Note: I am using Bootstrap.
Thanks,
Nathan

Replies

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    Modify the CSS using the principle shown here: http://editor.datatables.net/release/DataTables/extras/Editor/examples/stackedInputs.html . You just need to float the elements left with 50% width.

    Allan
  • nskwortsownskwortsow Posts: 120Questions: 0Answers: 0
    Works great, thanks.

    Can I pass a custom parameter somewhere in editor as a classname?

    I want to assign a certain class to the Bootstrap modal for certain inputs (a conditional in line 65 in xxx.bootstrap.js).

    Some forms are very short, and it doesn't make sense to arrange the form horizontally.

    Thanks,
    Nathan
  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    > Can I pass a custom parameter somewhere in editor as a classname?

    Yes - using `className` : http://editor.datatables.net/docs/current/Editor.models.field.html#className

    Allan
  • nskwortsownskwortsow Posts: 120Questions: 0Answers: 0
    Thanks, and how can I access the [code]className[/code] variable from within dataTables.editor.bootstrap.js (I imagine around line 60)?
  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    I don't really understand what you are trying to do. `className` will add a class to the wrapper for the field. That doesn't have anything to do with the display controller (the fields are simply put inside the display controller).

    If you want a custom class on the display controller, then yet, the bootstrap integration file would need to be altered.
  • nskwortsownskwortsow Posts: 120Questions: 0Answers: 0
    Indeed, the display controller (the modal which is triggered) should have a custom class name, based on a parameter that is passed when triggering the modal. Do you have a parameter which I can use for this?
  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    Currently no - you'd need to make a small modification to the display controller to add that ability. Good suggestion for future enhancement though. Noted :-)

    Allan
  • nskwortsownskwortsow Posts: 120Questions: 0Answers: 0
    OK, I did a workaround (looking at fields.length)
This discussion has been closed.