Accent neutralise plugin does not work when "data-order" tag is used
Accent neutralise plugin does not work when "data-order" tag is used
toxpal
Posts: 10Questions: 1Answers: 0
As the title says: the plugin does not work when "data-order" HTML5 tag is used. Type "Zurich" in filter fields in both demos below:
Working example: https://jsfiddle.net/a7c2Lh06/
Not working example ("data-order" HTML5 tag is used): https://jsfiddle.net/a7c2Lh06/1/
I was able to fix it by adding another attribute ("data-filter"), but I believe plugin should work without adding it.
Replies
You are using numbers for the
data-order
, for example<td data-order="1">New York</td>
. I believe the problem is that Datatables type detection will set the column type tonum
for ordering by number. See thecolumns.type
for more details.The plugin is replacing the search functions for type string and type html, for example:
There isn't a searchType for
num
. Since the column type isnum
the plugin isn't used. However if you use a string for thedata-order
the plugin will be used. I updated your example to show this by adding a console log statement to the above function and to use lettres for the first column.https://jsfiddle.net/7q3b0m4o/1/
Sounds like you either need to use
data-filter
like you said. Or you could usecolumns.render
for thefilter
operation to remove the accents using theremoveAccents()
function from the plugin. See Orthogonal data for details.Kevin
Thank you for the explanation. I will stick with data-filter then.