I’m using datatables 1.9.4 and the column filtering plugin. It works like a charm except that when I use ‘select’ tags for column filtering, the filter is not done for exact matches. It’s using wildcard search, which I do not want. I thought using a select element instead of text input would solve the problem but it doesn’t.
When i search for ‘Semester – I’, it should show only ‘Semester – I’ results. But it shows ‘Semester – II’ and ‘Semester – III’ matches too since the filter is not looking for exact match.
I tried jQuery DataTable ColumnFilter plugin. Can the "select" filter style support exact match? that and also http://code.google.com/p/jquery-datatables-column-filter/issues/detail?id=11 that. But none solved my problem.
JS CODE
$('#semester').dataTable({
"sPaginationType": "full_numbers"
})
.columnFilter({
aoColumns: [ { type: "text"},
{ type: "text" },
{ type: "select", values: [ 'Year - I', 'Year - II', 'Year - III', 'Semester - I', 'Semester - II', 'Semester - III', 'Semester - IV', 'Semester - V', 'Semester - VI', 'Semester - VII ( Integrated )', 'Semester - VIII ( Integrated )', 'Semester - IX ( Integrated )', 'Semester - X ( Integrated )']},
{ type: "text" },
null
]
});
Are there any other alternatives? Thanks in advance
UPDATE
I also tried the below, but that didn’t help too:
if (bRegex)
oTable.fnFilter($(this).val(), iColumn, bRegex);
else
oTable.fnFilter(unescape("^"+$(this).val()+"$"), iColumn, true);
Voila! Figured it out myself through a series of trial and error attempts. For those who are in a similar problem here is the solution:
In the plugin file, inside
select.change(function () {}), change this:to