2

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.

1 Answer 1

2

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();
  }
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.