"All" as an option for individual column filtering (using select menus)

"All" as an option for individual column filtering (using select menus)

ejhejh Posts: 17Questions: 0Answers: 0
edited July 2013 in General
I would like to have "All" listed ast the default select option instead of NULL as seen here:
http://datatables.net/release-datatables/examples/api/multi_filter_select.html

I see this as a 2 step process. First is creating "All" as an option for the select menu. Second I need to set the value of "All" = NULL.
being the current default.

Creating "All" as an option for the select menu is easily done with the following code:

[code]
function fnCreateSelect( aData ){
var r='', i, iLen=aData.length;
for ( i=0 ; i

Replies

  • allanallan Posts: 63,514Questions: 1Answers: 10,472 Site admin
    I don't actually see a null option in the example. There is an empty string - is that what you mean? Can you not just put "All" into the `option` tag for the empty string?

    Allan
  • ejhejh Posts: 17Questions: 0Answers: 0
    Allan,

    Yes, I did mean the "empty String."

    The reason that I referred to it as "NULL" was because I was not able to trace the code to see the "empty String."

    I guess my question is where is the "empty String" so that I can put "All" in it as you suggest?
  • ejhejh Posts: 17Questions: 0Answers: 0
    edited July 2013
    I tried:

    [code] function fnCreateSelect( aData ){
    var r='', i, iLen=aData.length;
    for ( i=1 ; i
  • allanallan Posts: 63,514Questions: 1Answers: 10,472 Site admin
    Try an empty string as the value:

    > var r='All'

    If that doesn't work, please link to a test case showing the issue.

    Allan
  • ejhejh Posts: 17Questions: 0Answers: 0
    Allen,

    Thank you again. I was SO CLOSE!!!

    As you can see from my code, I was putting "All" as the value when I should have put it as the text for the option tag.

    DataTables takes the value of the "empty string" to display all of the values in the column. By default DataTables has no text for the for the option where the value is the "empty string."

    I hope that my question helps others.

    You may want to consider making "All" the default text for the option tag.

    Again I can only say, "Doh!"
This discussion has been closed.