I've got a drop down list that filters a table. I want the drop down list to repopulate every time the table has been filtered to only show the remaining (unique) items. Currently I have the following function
function rePopulateSelectList(column, control) {
//wipe the previous drop down
$('#' + control).find('option').remove();
//
$('#adminTable tr').each(function () {
$.unique($(this).find('td:eq(' + column + ')')).each(function () {
var columnText = $(this).text();
$('#' + control).append('<option value="' + columnText + '">' + columnText + '</option>');
});
});
}
the drop down is being repopulated (on the select.change() event) but I'm ending up with at least twice as many drop down options, none of which are unique