$.fn.dataTableExt.ofnSearch['icon'] doesn't work anymore after upgrade from 1.9 to 1.10
$.fn.dataTableExt.ofnSearch['icon'] doesn't work anymore after upgrade from 1.9 to 1.10
Noone1981
Posts: 1Questions: 1Answers: 0
I had a method which was used to be able to seach on the title of an icon in a column.
$.fn.dataTableExt.ofnSearch['icon'] = function(a) {
return getTitleFromHtml(a);
};
Which doesn't work anymore. I use mRender to render the data as an icon in a column, but the sort/filter isn't triggered. I read somewhere else to use mData instead but that doesn't help either.
Can someone point me to the right direction?
This discussion has been closed.
Answers
You are correct in using
columns.render
. Sounds to me like you will need to create your own custom sorting function for this column. Here is a snippet of example codeIn your case, I would give each icon a text attribute and return that in the custom sort function. That value will be what DataTables sorts and filters on.
Another option would be using just
columns.render
in the following way taken from the linked API pageUse different data for the different data types requested by DataTables (
filter
,display
,type
orsort
). The property names of the object is the data type the property refers to and the value can defined using an integer, string or function using the same rules ascolumns.render
normally does.Note that an
_
option can optionally be specified. This is the default value to use if you haven't specified a value for the data type requested by DataTables. If there is no option for the data type requested that the_
option has not been specified, the data pointed to by thecolumns.data
option will be used.Interesting that
ofnSearch
doesn't work - it should. I'll look into that. Having said that, it was a fairly horrible hack and the orthogonal data that @jr42.gordon describes is much better.Allan