使用 tablesorter 搜索小部件显示未找到记录
Show no record found using tablesorter search widget
我使用 "jquery.tablesorter.widgets.js" 作为 Table 过滤器工作正常,但当根据搜索条件没有记录时,我必须显示“未找到数据”。我没有在 table 上使用任何寻呼机。我检查了这个 link TableFilter Plugin with Null Data 但无法解决我的问题。
如果没有寻呼机,您需要自己创建消息行 (demo):
CSS
tr.noData td {
background: #eee;
color: #900;
text-align: center;
}
JS
$('table').on('filterEnd filterReset', function() {
var c = this.config,
fr = c.filteredRows;
if (fr === 0) {
c.$table.append([
// "remove-me" class added to rows that are not to be included
// in the cache when updating
'<tr class="noData remove-me" role="alert" aria-live="assertive">',
'<td colspan="' + c.columns + '">No Data Found</td>',
'</tr>'
].join(''));
} else {
c.$table.find('.noData').remove();
}
});
我使用 "jquery.tablesorter.widgets.js" 作为 Table 过滤器工作正常,但当根据搜索条件没有记录时,我必须显示“未找到数据”。我没有在 table 上使用任何寻呼机。我检查了这个 link TableFilter Plugin with Null Data 但无法解决我的问题。
如果没有寻呼机,您需要自己创建消息行 (demo):
CSS
tr.noData td {
background: #eee;
color: #900;
text-align: center;
}
JS
$('table').on('filterEnd filterReset', function() {
var c = this.config,
fr = c.filteredRows;
if (fr === 0) {
c.$table.append([
// "remove-me" class added to rows that are not to be included
// in the cache when updating
'<tr class="noData remove-me" role="alert" aria-live="assertive">',
'<td colspan="' + c.columns + '">No Data Found</td>',
'</tr>'
].join(''));
} else {
c.$table.find('.noData').remove();
}
});