显示没有使用tablesorter搜索小部件找到的记录 [英] Show no record found using tablesorter search widget

查看:116
本文介绍了显示没有使用tablesorter搜索小部件找到的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用"jquery.tablesorter.widgets.js"来使表格过滤器正常工作,但是当基于搜索条件的记录不可用时,我必须显示未找到数据".我在桌上没有使用任何传呼机.我已经检查了此链接带空数据的TableFilter插件,但无法解决我的问题. /p>

I am using "jquery.tablesorter.widgets.js" for Table filter working fine, but I have to display " No Data Found" when records not available based on Search Criteria. I'm not using any pager on my table. i have checked this link TableFilter Plugin with Null Data but unable to resolve my problem.

推荐答案

没有寻呼机,您需要自己创建一条消息行(

Without the pager you'll need to create a message row yourself (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();
  }
});

这篇关于显示没有使用tablesorter搜索小部件找到的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆