[fpc-devel] fcl-web webdata ExtJS "total" field question
Michael Van Canneyt
michael at freepascal.org
Thu Aug 19 11:35:41 CEST 2010
On Wed, 18 Aug 2010, ABorka wrote:
> Hi,
>
> 1. Should not the JSON replies have a "total" returned always like the XML
> replies?
> Right now "total" is not returned if the "start"/"limit" is not passed to the
> formatter.
As far as I understand it, total is only needed when you do paging; Paging
is indicated with the start/limit.
>
> 2. How can I provide the correct "total" for the response if I only loaded
> exactly the records requested by ExtJS into the dataset but not the whole
> table?
> Ex: Have a table with 1000 records, I'm on page 2 of the grid that has a page
> limit of 50 records.
> Of the total 1000 records, only about one third should be visible for the
> person currently requesting data.
> Therefore, I run a SQL statement to get those next 50 records from the 333
> potential ones for this person, and that will be displayed in the grid, and
> only those 50.
> This way, only I can tell in the response the correct "total", which is 333
> in this case. 50 was passed to the formatter/adapter.
Well, I have no idea. As far as I know, the 'total' is only needed for
display purposes in a paging grid. You'd need to run a second query which
counts the number of records that would be returned if no paging was
requested.
Michael.
More information about the fpc-devel
mailing list