I'm using datatables v1.92 along with the column filtering plugin v1.5.0.
THE PROBLEM
I need to create drodowns for individual column filtering whose markup will be
<option value="1">Abc</option>
<option value="2">Def</option>
<option value="3">Ghi</option>
This is because the values coming from the database are 1, 2, or 3
. The label displayed to the user is either Abc, Def, or Ghi
Using the column filtering plugin, I'm able to create a dropdown for a column using
.columnFilter({
aoColumns: [ type : 'select', values:['1', '2', '3']
]
});
The problem is that the markup of that dropdown turns out to be
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
So the user is shown 1, 2, 3
as the drop down labels instead of Abc, Def, Ghi
WHAT I TRIED
I tried to hardcode the dropdown in the <tfoot>
section of the datatable, but then
.columnFilter({
aoColumns: [ type : 'select', values:['1', '2', '3']
]
});
overwrites the hardcoded dropdown. I even tried passing null
as the parameter for aoColumns
but that didn't work too as it simply removed the hardcoded dropdown.
So is there a way that I can create the dropdown in which the value
attribute will hold a numerical value whereas the label between <option>
and </option>
will be text?