PDA

View Full Version : limit in Store requests always 25.



pcr
15 Jan 2011, 3:23 AM
I Post question in the Help forum. Maybe it is a bug so I post it too Bugs.
Maybe this helps to get a response anyway.

Maybe I forgotten something to do. All requests for loading a store are send with param limit=25. If I configure in extraParams a param limit: 9999 seems to be overruled. If I remove the param limit: 9999 in my extraparams Sencha-touch still adds a param limit=25.

Is there somewhere a default overruling param for limit??

Here is some debug report. Watch the limit=25 in the request.




Javascript:
this.servincidentStore = new Ext.data.Store({
model: 'Incident',
storeId: 'incident',
proxy: {
type: 'ajax',
url: '/generator-grid/BackendGrid/incidentGridBackend.php',
method: 'POST',
extraParams: {
mobile: true,
start: 0,
limit: 9999,
userProfielId: profielid,
task: 'LISTING',
xvelden: ', incident.PersoonId ',
sort: 'incident.Incident',
dir: 'ASC'
},
reader: {
type: 'json',
root: 'results'
}
}
});

Debug info:

Verzoek-URL:http://localhost/generator-grid/BackendGrid/incidentGridBackend.php?_dc=1295089977116&mobile=true&start=0&limit=25&userProfielId=791&task=LISTING&xvelden=%2C%20incident.PersoonId%20&sort=incident.Incident&dir=ASC
Verzoekmethode:GET
Statuscode:200 OK
Vraagkopteksten

AndreaCammarata
15 Jan 2011, 3:32 AM
Hi pcr.
This is not a bug, I thought it too, but take a look at this post to know how to configure your store.

http://www.sencha.com/forum/showthread.php?118445-CLOSED-1.0.1-Ext.data.JsonStore-quot-limit-quot-param-issue

Hope this helps.

pcr
15 Jan 2011, 4:58 AM
Hi Andrea,

Thank you very much. This works. Now the stores are requested with method: 'POST'.
Now I still have that weird feature about limit is always 25. if the method: 'POST' it's the same. limit always send as 25???

Do you have such a nice solution like this??

thanks

mitchellsimoens
15 Jan 2011, 9:12 AM
did you set the pageSize param?


new Ext.data.Store({
...
pageSize: 100,
...
})

pcr
15 Jan 2011, 9:27 AM
Hi Mitchell,

Thats was the problem. pageSize is new to me. Probably it's part of a new strategy for paging.

I expect that the data->proxy-> reader concept of Sencha will be the new strategy for ExrJS 4.0 as well.

It would be great if some Sencha guru make a FAQ for ExtJS to Sencha people.


Thank you for your help.

mitchellsimoens
15 Jan 2011, 9:32 AM
For the most part, Sencha Touch is the same as ExtJS. Sure there are differences but that's where you just need to spend time reading the Docs (found the pageSize param in the Docs under Store -> public properties) and the actual source. I spend everyday looking at the Docs, I remember a lot of it but everyone still looks to make sure they are sure about what it is they need to do.

And the "Sencha guru"s look at the source a lot. This will do 2 things: let you know how things work which will let you know how to do something and it will also, hopefully, show you a better way to code.

For instance, I made my TouchGridPanel by reading code from ExtJS. This told me exactly how things work in ExtJS.

pcr
15 Jan 2011, 9:55 AM
Thanks again. Very clear. I wasn't aware of so much differences between ExtJS en Sencha-touch. I got response from Ed SPencer in another thread with the same issue. He confirmed ExtJS data package will be the same as the data package in Sencha touch.

A small problem is I want to use the same backend PHP scripts build for ExtJS. Thanks God now they do without changes.

BTW he said make pageSize: undedined makes skipping the limit: 25 (default) completely.

From now on I know to read the docs more as I allready did.

mitchellsimoens
15 Jan 2011, 9:58 AM
I would warn you one thing and I have seen apps and devs do this time after time... Mobile devices are starting to get really powerful but you should still think about performance of you app. In ExtJS, it's fine to have 100 rows in a grid and do other things but in Sencha Touch, the device may not be able to handle 100 rows. This is why paging is turned on by default. You can make your PHP scripts look for the paging params and use them if present. If not, then do not page.

I would highly recommend that you use paging in Sencha Touch (and ExtJS for that matter but not needed as much).

pcr
16 Jan 2011, 7:58 AM
I'm Ok with that. Even in ExtJS I use paging if the selected records can be large. My strategy for mobile devices is to make a choice to pre-load small (lookup)stores and use filters or everytime I need another selection reload the store from the server with other parameters. A lot of mobiles are not connected with wifi but with a public network with restricted plans. So loading is slow, time-consuming and expensive. I inspected some online apps and saw some are load some kb of data (like pictures) to work with.
Ok I agree we have to be carefull with loading much data and test test test

Do you know how much loaded data Safari in iPad able to handle???