differentiate the iTotal and iTotalDisplay stats for server processing

differentiate the iTotal and iTotalDisplay stats for server processing

kimsiakimsia Posts: 14Questions: 0Answers: 0
edited January 2012 in General
Hi Allan,

I have completely resolved all the issues I need with datatables.

I am left with an academic question.

what does iTotal and iTotalDisplay refer to?

I read that unless filtering is turned on, these two numbers should be the same.

I don't understand.

Anyway, i leave my server-side code to handle all the filtering. Meaning to say I rely on MySQL queries

Select * from products where product.visible = 1 order by products.title asc limit 10, 10

So in such a scenario, I should simply return both the iTotal and iTotalDisplay as the no. of records found for

Select COUNT(*) from products where product.visible = 1

Am i right?

Replies

  • allanallan Posts: 63,540Questions: 1Answers: 10,476 Site admin
    You mean iTotalRecords and iTotalDisplayRecords? Basically they tell DataTables paging information. For example if you have a table that has 100 records, but pagination enabled and are only returning 10 records per page, you need to tell DataTables that there is 100 records, so it can enable pagination controls and display the table information ("Showing x to y of z").

    When you apply filtering, you need to send extra information, you need to be able to say how many records are in the filtering result set, hence why there are two parameters.

    So no, it is not as simple as just returning the table cardinality, unless you have filtering disabled.

    Allan
  • kimsiakimsia Posts: 14Questions: 0Answers: 0
    Yes I have disabled Filtering by datatables.net because I want to disable that search function which datatables.net provides.

    In that case, i will always return both values as same.
This discussion has been closed.