How to customize "sLengthMenu"

How to customize "sLengthMenu"

tinmichaeltinmichael Posts: 4Questions: 0Answers: 0
edited December 2010 in General
I would like to change this "Show DropDownBox Entries" to "CheckBox input" I have tried this 'Display Show non-expired records only' but no success. Do you have any idea how to accomplish to customize "show entries dropdownbox" to "show only checkBox". Hope you understand my question, if not pls let me know. thanks :)

Replies

  • allanallan Posts: 63,510Questions: 1Answers: 10,471 Site admin
    Hi tinmichael,

    I would probably suggest not changing the language string for the length element, as you appear to be planning, as it's not really designed for what you are looking for (the event handler won't do what is needed for example), but rather drop the length element from sDom and put in a custom toolbar with the checkbox you want - something a bit like this: http://datatables.net/examples/advanced_init/dom_toolbar.html .

    You can then attach an event listener to the checkbox such that when clicked on it will call fnFilter ( http://datatables.net/api#fnFilter ) to either add or remove a filter which will show or not the expired records (assuming I understand correctly). This should be reasonably straight forward if you have a column which indicates if a record has expired or not (just filter on that column).

    Regards,
    Allan
This discussion has been closed.