ColumnControl - search with different order and search type
ColumnControl - search with different order and search type
Link to test case: https://live.datatables.net/gezadipu/12/
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
Is there any way to serach priority col as text not number and also order as number?
I found columnDefs like this, but i want to target search in menu, which still act as number
columnControl: {
target: 1,
content: ['searchText']
}
This question has an accepted answers - jump to answer
Answers
https://live.datatables.net/gezadipu/13/edit
You'd just missed the
columnControlproperty in thecolumnDefsobject.Good point this - I'll see if I can improve the default handling for that.
Allan
@Allan I think I might have found a bug.
https://live.datatables.net/gezadipu/15/
Try searching using "Contains" and type "normá".
The Task column works correctly, but in Priority it returns no results. Or am I missing something?
Looks like there be a normalisation error when working with the data attributes. I'll take a look into it.
Allan
Have there been any updates or progress?
Thanks for the prompt - I've been working on other aspects and only just circling back to this today.
I've just been digging into it and the issue is with the combination of
data-orderanddata-search. The issue is that the data type is detected as numeric (due to the order property), so there is no normalisation done on the search value (since it isn't needed for search).There are a bunch of options to resolve this:
data-searchdata-order(a, b, c, etc if you need to define an order).searchproperty for thenumtype. This can be done with:Here is an updated example: https://live.datatables.net/gezadipu/16/edit .
A true fix would see a separation of data types for search, order and display, but that is a major overhaul which I can't do at the moment. Option 3 above might be the best option for you just now I think, as it is one line of extra code and uses the public APIs.
I'll need to think further on what, if any, changes to make in DataTables as a result of this!
Allan