我正在使用YADCF datatables 的插件我正在使用 exResetAllFilters 重置所有列过滤器,但它不起作用。
我做了一个example使用 Jsfiddle。 使用Firebug我可以看到错误:
TypeError: string is undefined
return string.replace(new RegExp(escapeRegExp(find), 'g'), replace);
我已经在 YADCF 库中更改了此函数,并且还生成TableSelectorJQFriendly 来检查字符串是否为空。
function replaceAll(string, find, replace) {
if (string) {
return string.replace(new RegExp(escapeRegExp(find), 'g'), replace);
}
else {
return string;
}
}
function generateTableSelectorJQFriendly(tmpStr) {
if (tmpStr) {
tmpStr = replaceAll(tmpStr, ".", "-");
tmpStr = replaceAll(tmpStr, ' ', '');
return tmpStr.replace(":", "-").replace("(", "").replace(")", "").replace("#", "-");
}
else {
return tmpStr
}
}
进行这些更改后,我看到了不同的错误
TypeError: table_arg.fnDraw is not a function
table_arg.fnDraw(settingsDt);
如何修复它?
最佳答案
jsfiddle 中的问题只是与其 wrapping way 相关的 jsfiddle 问题。 ,
我已经通过使用 .click
而不是 dom onclick 解决了这个问题(我这样做只是因为它的 jsfiddle - 在普通的网络应用程序中,你可以毫无问题地使用 onclick ) , see working jsfiddle ,如果您有任何其他可以重现的问题,请随时询问
关于javascript - 数据表 YADCF 重置所有列时出错 (exResetAllFilters),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35464410/