How to add a class in if no record found?

How to add a class in if no record found?

claudchanclaudchan Posts: 3Questions: 1Answers: 0

Hi,
Anyone can guide me how to add a class eg. "no-record" in the

<

table> if no record found?

Example:

<

table class="dataTable no-record">

Answers

  • claudchanclaudchan Posts: 3Questions: 1Answers: 0

    I found the solution:

    "fnFooterCallback": function (nRow, aaData, iStart, iEnd, aiDisplay) {
        if (aiDisplay.length > 0) {
            this.removeClass('no-record');
        }
        else {
            this.addClass('no-record');
        }
    }
    

    Output:

    <table class="dataTable no-record">...
    
This discussion has been closed.