PDA

View Full Version : onMetaChange - Possible Logic Bug



Richard
14 Jun 2007, 2:14 AM
Overview

I think for the Json reader with an 'onMetaChange' the following should happen:

ExtJS programmer point of view
First load
1. Request metadata (client)
2. Return metadata and first record set (server)
New page
1. Request next record set (client)
2. Return recordset (server)

ExtJS actual internal code for above
First load
1. OK
2. OK, but the total record count comes from the returned record count, not the total number of possible records
New Page
you can never get the next record set because the total possible count is set to the pagesize.

Using the code from 'Below' and a hack of the returned Json, gets it all to work, but I think it is incorrectly done because of the reuse of the internal 'meta' where it should be replaced by each new recordset request.


Ah nice!
After experimenting a bit I came up with this:
http://ext.designism.nl/examples/autosetupgrid/autosetupgrid.html

What do you think?

Maybe something like this should be supported in Ext2.0

All works ok for a non paging grid, if you add a pagingToolbar you need to return for the first load to get the meta data


({'results':234,'metaData':{'root':'rows','results':234,'totalProperty':'results','id':0,'fields':[{'name'

:'id','type':'int'},{name:'a0',header:'CountryID'},{name:'a1',header:'CountryName'},{name:'a2',header

:'ISOCode'},{name:'a3',header:'ISDCode'}]},'rows':[

{'i1':1,'a0':'1','a1':'Afghanistan','a2':'AF','a3':'93','a4':'1'},

{'i1':2,'a0':'2','a1':'Albania','a2':'AL','a3':'355','a4':'2'}, remainder deleted

then the standard response


({'results':234,'rows':[

{'i1':53,'a0':'53','a1':'Congo, The Democratic Repuplic of the','a2':'CD','a3':'243','a4':'53'},

{'i1':54,'a0':'54','a1':'Cook Islands','a2':'CK','a3':'682','a4':'54'},

{'i1':55,'a0':'55','a1':'Costa Rica','a2':'CR','a3':'506','a4':'55'},remainder deleted

for each set of pages.

SO, am I wrong or does ExtJS have a problem.