admin管理员组文章数量:1435859
I am pretty surprised at how custom filtering works in datatables. It seems like i need to define a global filter function like this:
$.fn.dataTableExt.afnFiltering.push(function (oSettings, aData, iDataIndex) { .. });
and then ALL datatables on my page will use that function to filter. This is not acceptable.
What i need is a way to programmatically filter a datatable using a custom filter function. I would expect this function to take a row and return true/false based on some criteria to show/hide that row from the result.
does a way of doing this exist?
I am pretty surprised at how custom filtering works in datatables. It seems like i need to define a global filter function like this:
$.fn.dataTableExt.afnFiltering.push(function (oSettings, aData, iDataIndex) { .. });
and then ALL datatables on my page will use that function to filter. This is not acceptable.
What i need is a way to programmatically filter a datatable using a custom filter function. I would expect this function to take a row and return true/false based on some criteria to show/hide that row from the result.
does a way of doing this exist?
Share Improve this question asked Aug 30, 2012 at 14:56 mkoryakmkoryak 58k64 gold badges203 silver badges262 bronze badges1 Answer
Reset to default 2does this link help:
http://datatables/forums/discussion/8435/remove-custom-filtering/p1
/* Custom filtering function which will filter data in column four between two values */
$.fn.dataTableExt.afnFiltering.push(
function (oSettings, aData, iDataIndex) {
if ( oSettings.nTable.id === "my_filtering_table" ) {
var selectCode = document.getElementById('statusSelect').value;
return filterRow(selectCode, aData);
}
else {
return true;
}
}
);
本文标签: javascriptdatatables custom filteringStack Overflow
版权声明:本文标题:javascript - datatables custom filtering - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745652923a2668538.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论