我正在使用 DataTables plugin在我网站的多个页面上,当没有找到记录时,我需要它在每个页面上显示不同的消息。
现在我使用下面的当前消息:
"oLanguage": {
"sEmptyTable": "There is no data available for the week selected."
}
有没有什么方法可以在 oLanguage 中放置一个条件语句来检查当前页面?像这样的东西:
if (currentPage == "thisPage")
"sEmptyTable" : "There is no data on this current page"
最佳答案
我不知道这个技巧是否适用于数据表,但您可以尝试将“sEmptyTable”作为函数传递:
"oLanguage": {
"sEmptyTable": function(){ return "There is no data"; }
}
请参阅此 fiddle http://jsfiddle.net/tRTkd/用于设置按钮文本的演示。
关于javascript - jquery 数据表插件 : custom message per page when table is empty,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21733643/