Option order in column select filters
Option order in column select filters
iecwebmast
Posts: 66Questions: 9Answers: 1
Is there a way to reorder select filter the options alphabetically?
I plan to use this feature in a number of pages to allow users to filter information displayed.
Datatables works great for this. I would just like to help people find things in the list easier.
The options in each column select filter are in the order they appear in the table, which is more often than not all mixed up.
Here is an example of a simple page. If you look at the "Committee" or "Country" filters you will see the dilemma.
http://beta.iec.ch/about/awards/1906/1906_recipients_2010.htm
I plan to use this feature in a number of pages to allow users to filter information displayed.
Datatables works great for this. I would just like to help people find things in the list easier.
The options in each column select filter are in the order they appear in the table, which is more often than not all mixed up.
Here is an example of a simple page. If you look at the "Committee" or "Country" filters you will see the dilemma.
http://beta.iec.ch/about/awards/1906/1906_recipients_2010.htm
This discussion has been closed.
Replies
Allan
Maybe the demo page should be updated to add the .sort().
So instead of:
[code]
$("tfoot th").each( function ( i ) {
this.innerHTML = fnCreateSelect( oTable.fnGetColumnData(i) );
$('select', this).change( function () {
oTable.fnFilter( $(this).val(), i );
} );
} );
[/code]
...change to:
[code]
$("tfoot th").each( function ( i ) {
this.innerHTML = fnCreateSelect( oTable.fnGetColumnData(i).sort() );
$('select', this).change( function () {
oTable.fnFilter( $(this).val(), i );
} );
} );
[/code]