Move search box

Move search box

perbwperbw Posts: 2Questions: 0Answers: 0
edited May 2009 in General
Is it possible to move the search box to the top left corner. Default position is to the right.

Replies

  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin
    It certainly is - have a look at the sDom parameter: http://datatables.net/usage#sDom - example: http://datatables.net/examples/example_dom.html

    It might even be possible to do with the default sDom settings and just move it around with CSS :-)

    Allan
  • perbwperbw Posts: 2Questions: 0Answers: 0
    Could you please give me an example, I cant get it to work??

    Per
  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin
    Hi Per,

    Type settings sDom to "flrtip". That will put the filter before the display length menu. If that fails then you'll need to modify the CSS slightly - probably just a float issue if so.

    Allan
  • sethwbsethwb Posts: 1Questions: 0Answers: 0
    This is very confusing for me -

    How do I instruct DataTables to put the Search box in the element with id="TableViewOptions" ?

    # < and > - div elements
    # <"class" and > - div with a class

    relatively makes little sense - what do you put in place of "and?" or is that part required? I don't get it.
  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin
    Hi sethwb,

    There is no way to enter an element with a specific ID using sDom (as indicated by the documentation - if implicitly, rather than explicitly, since it doesn't document how to give an element an ID :-) ). If you really wanted an ID, you could assign a class using sDom, and then once the DataTable has finished it's initialisation, use a single jQuery expression to add an ID.

    Also, it's probably worth having a look at the example of how to use sDom: http://datatables.net/examples/basic_init/dom.html

    Regards,
    Allan

    Ps. Don't hesitate to open a new thread with your questions, rather than dragging up an old thread from May :-)
This discussion has been closed.