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

Michael Van Canneyt michael at freepascal.org
Fri Aug 20 09:29:58 CEST 2010



On Thu, 19 Aug 2010, ABorka wrote:

>>> ...snip...
>>>> 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.
>>> 
>>> 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?
>> 
>> Good point.
>>> 
> ...snip...
>>> 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.
>> 
>> Yes. I don't think you should manipulate the stream; it is too slow.
>> 
>> I will add an 'AfterFormatResult' or so event; Likewise I will add a
>> AfterRow event, so it is possible to append extra data to a row. I think
>> we should do this for both XML and JSON, so the row/response elements
>> can easily be accessed. The question is now, a) do I make this a
>> TNotifyEvent, and make a Property Response/CurrentRow which can be used
>> or b) do I pass Response/CurrentRow to a new event handler type for
>> these events ?
>> 
>> Doing a) means I can introduce it at a higher level, but b) seems more
>> clean.
>> 
>> Michael.
>
> Sounds good. For me personally, it does not matter either way, just need to 
> make this work :) . If we can intercept/access these row/response elements in 
> an easy way, I'm happy.

I implemented b), see revision 15859.

I also now add a 'rows' property to the error response object, so the
ExtJS exception handling will work with 'remote'.

I'm still doubting to implement an OnErrorResponse event. It may be useful
for logging purposes, or to change the reported error, since there is no way
to intercept that currently. What do you think ?

Michael.



More information about the fpc-devel mailing list