cyberhobo / ColumnFilterWidgets

This is an add-on for the DataTables plugin for jQuery that creates filtering widgets based on the data in table columns.
69 stars 34 forks source link

Values don't reappear in select when filter is removed #29

Closed Jumpy555 closed 10 years ago

Jumpy555 commented 10 years ago

If I select two or more values in a select and then I remove one of theme by clicking on it, it doesn't reappear in the select unless I remove all other values.

Thank you, Jumpy

Jumpy555 commented 10 years ago

I realized that the values reappear in the select, but at the bottom, not alphabetically.

So I made a correction to the code at line 201: // Add it back to the select // widget.$Select.append( $( '' ).attr( 'value', sSelected ).text( sText ) ); $('option',widget.$Select).each(function() { //Adding the first condition to avoid the first option with column name if($(this).val()!=''){ if($(this).text() > sText) { $(this).before($( '' ).attr( 'value', sSelected ).text( sText )); return false; } } });

Now, when I remove a selected value, it reappears at the correct position. Hope it helps. Thank you for your work.