Problem in getting message if there is empty table

Problem in getting message if there is empty table

kumarskumars Posts: 7Questions: 0Answers: 0
edited November 2013 in General
Hi All,

I would like to have message if there is empty table. I have multiple table in my page and I would like to have this message for each table and I was trying with one table but it is not working.
Here is my code:

$(document).ready(function() {

var table7 = $('#table7').dataTable({
"bLengthChange": false,
"bFilter": false,
"oLanguage": {
"sInfoEmpty": "No data available"
}
});

var table8 = $('#table8').dataTable({
"bLengthChange": false,
"bFilter": false
});

});


When I used this code:
Table header is coming for table7 but message is not coming if it is empty table.

Is there anything wrong I am doing?

Thanks.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Please link to a a test case showing the problem.

    Allan
  • kumarskumars Posts: 7Questions: 0Answers: 0
    Hi Allan,

    here is my test case of table7:
    In this code taking data from "data" via for loop and checking opsid2 and mp and if data is available then it display in tbody. but if data is not matching then it comes blank without "No data available" message, which I want. This code is a mixture of web2py python and html.

    DB information on proteolytic event:



    DB ID
    Cleav No.
    Cleav Seq




    {{for row in data:}}

    {{if opsid2 == row[7] and mp == row[15]:}}



    {{=row[0]}}
    {{=row[17]}}
    {{=row[18]}}

    {{pass}}

    {{pass}}
  • kumarskumars Posts: 7Questions: 0Answers: 0
    Sorry Allan can not make the link, it is running localhost.
  • kumarskumars Posts: 7Questions: 0Answers: 0
    Hi All,

    I am still struggling in displaying empty table message.

    In this code taking data from "data" via for loop and checking opsid2 and mp and if data is available then it display in tbody. but if data is not matching then it comes blank without "No data available" message, which I want. This code is a mixture of web2py python and html.




    $(document).ready(function() {

    var table7 = $('#table7').dataTable({
    "bLengthChange": false,
    "bFilter": false,
    "oLanguage": {
    "sInfoEmpty": "No data available"
    }
    });

    var table8 = $('#table8').dataTable({
    "bLengthChange": false,
    "bFilter": false
    });

    });



    DB information on proteolytic event:



    DB ID
    Cleav No.
    Cleav Seq




    {{for row in data:}}
    {{if opsid2 == row[7] and mp == row[15]:}}



    {{=row[0]}}
    {{=row[17]}}
    {{=row[18]}}

    {{pass}}

    {{pass}}


    Please suggest me some solution...

    Thanks
This discussion has been closed.