[fpc-devel] fcl-web webdata ExtJS "total" field question

ABorka fpc-devel at aborka.com
Thu Aug 19 21:17:52 CEST 2010

>> 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.

Hi Michael,

I understand.
However, how do we send back our own "total" we got from our second 
query? How do we append/update it into the response?

With XML, FCL-web always appends a "total" so that should be overwritten 

I guess we can trick FCL-web to not append its own "total" with JSON by 
sending only the 50 records needed and saying to it that the "start" is 
the 1st one and "limit" per page is 51 even if those 50 come from a 
table of 1 million records.

It seems we need to manipulate the tmemorystream that is generated by 
the formatter? Maybe we should make this a little bit easier for 
developers somehow.


More information about the fpc-devel mailing list