Do you have better way to know if server side table is empty?
Do you have better way to know if server side table is empty?
Simonsheng
Posts: 10Questions: 0Answers: 0
I am checking server side table if it is empty or not by the div that id is 'tableName_info'(under the table bottom, and show entry's number )
I get it's text that is "Showing number to number of number entries" and split them by space into array, then I need the number after "of"
the code is below. but it is urgily, I don't like this way! does datatabe has some thing I can read or occur so I can check if it is empty or not?
[code]if($('#tableName_info').text().split(" ")[5]!=0)
{
do something for table has record
}
else
{
do something for empty table
}[/code]
and I know oSettings.fnRecordsTotal() can return the Record's number , but I don't know how to use it in my webpage.
Can anyone demo me?
Thank you very much.
I get it's text that is "Showing number to number of number entries" and split them by space into array, then I need the number after "of"
the code is below. but it is urgily, I don't like this way! does datatabe has some thing I can read or occur so I can check if it is empty or not?
[code]if($('#tableName_info').text().split(" ")[5]!=0)
{
do something for table has record
}
else
{
do something for empty table
}[/code]
and I know oSettings.fnRecordsTotal() can return the Record's number , but I don't know how to use it in my webpage.
Can anyone demo me?
Thank you very much.
This discussion has been closed.
Replies
Allan
More Information:
I use getread to create datatable first, later when I need the iTotal, I am tring use the code to read iTotal.
[code]
this.fnPagingInfo().iTotal
[/code]
If that doesn't work, can you give us a link to the page please?
Allan
[code]
"fnDrawCallback": function (oSettings) {
if (oSettings._iDisplayEnd == 0) {
... // your code here
}
}
[/code]
Allan