individual colums search - dropdown list with predefined values
individual colums search - dropdown list with predefined values

In regards to this example:
https://datatables.net/examples/api/multi_filter_select
From what I see, dropdown lists gather their options as complete cells.
How to make these dropdown lists with custom, predefined values?
For example, if table has a colum with data like
a b c h
d e f
g h i
and selector (for that column) like this:
<option value="a">show rows with a</option>
<option value="h">show rows with h</option>
<option value="e">show rows with e</option>
I'd like to get rows pointed as shown by values respectively.
I'm using such theme in dynamitable scripting, but I'd like to update it due to performance issues.
Answers
My initial thought is you will need to change the search. Instead of
.search( val ? '^'+val+'$' : '', true, false )
you might be able to get away with a simple search like.search(val)
. Worst case is you will need to use a regex search but it would use different tokens.This example just shows the simple search, no drop down list:
http://live.datatables.net/lenufere/1/edit
Kevin
I'd like to remake this one:
http://planetaziemia.net/kpp/index.html
into datatables.
The problem with current scripting is, that it works too slow. I'd like to have dropdown lists in other colums, not search boxes.
You can replace the example
code that builds options list with whatever you want. This is the code the builds the list:
Replace it with your hard coded options lists for each column.
Here is a simple example adapted from another of my examples:
http://live.datatables.net/lenufere/2/edit
Note the use of two headers and
orderCellsTop
to move the sorting to the top header.Kevin