How to display the actual number of rows in a page, in the DataTable footer.

How to display the actual number of rows in a page, in the DataTable footer.

ntn90ntn90 Posts: 2Questions: 1Answers: 0
edited April 2016 in Free community support

I am new to this wonderful DataTable component. Basically in my scenario let us say the database query returns 100 records. Out of those 100 records I create a page frame of 50 records always(in my case pageLength: 50) . But instead of sending a page frame of 50 records, I am again filtering those records based on some search text. So let us say I got 20 records filtered(out of 50 originally on that page). I am now sending the page frame of 20 records to the client side to render. But it shows "Showing 1 to 50 of 100 entries" even if 20 rows are there for that page. I could not achieve this. So I plan to display in the table footer something like for example "Total filtered records in page=20" instead of the usual information "Showing .... entries". So basically what I want is to show the "actual rows" in the current page. Each page may have different rows in the table because of my final filter, just before sending to the client side. I see that "language" "info" could be the answer to this, but how can I dynamically count the actual rows that are there in the table for the current page and show something like "Total filtered records in page=20" for example(so basically using table.fnGetData().length to get number of rows in the current page) .

Thanks

Answers

  • allanallan Posts: 61,985Questions: 1Answers: 10,162 Site admin

    Thanks for your question - however, per the forum rules can you link to a test case showing the issue please. This will allow the issue to be debugged.

    Information on how to create a test page, if you can't provide a link to your own page can be found here.

    Thanks,
    Allan

  • ntn90ntn90 Posts: 2Questions: 1Answers: 0

    Thanks Alan for your feedback. Actually sending a test case at this stage may not be possible.But if you could just please let me know how to refer to custom token values in the "language" "info", then that would be nice really and would solve the issue. So in this case I will add one more property in my Java class (e.g getPageRowCount() ) and try to refer in the "Info". I see already that "info" values referring to token values such as START, END. But I am not sure if I can allow "Info" to read other values. If you could please provide some hints in that direction, that would solve our issue.

This discussion has been closed.