PDA

View Full Version : Help! Paging of Grid - shows all records, even with pageSize and limit set to 25 :(



DuGi
13 Jun 2007, 8:26 AM
Hey guys (& girls?),

First of all, I'm very new to extjs - first time I'm ever using it. So, I'm dont know EVERYTHING about extjs obviously.

Well here's my problem. I'm trying to make a webmail for my IMAP account. So to list my e-mails I'm using the grid-function. But since I have 300+ mails, I would like to my a paging toolbar. So, I tried the example in the documentation (Paging and remote datasets).

When I load my page. It doesn't split the 300 records up in page. Or actually it does, but it shows EVERY e-mail - 300+ - on every page.

So here is my question. How does the paging toolbar actually work. Does it send some parameters to url given in HttpProxy, so I then in my php-script can only print x-records?

I mean, I print every 300+ e-mails in JSON-format at once, but I thought that the paging toolbar would split it up? Or is that my job, and the paging toolbar just handles the viewing and switching between pages?

Forgive me, If I sound very stupid - but hey, I have to learn it somewhere, right? :)

Here is my code:
[CODE]
var ds = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: domain+'scripts/mailbox/inbox/list/'
}),

reader: new Ext.data.JsonReader({
root : 'mails',
totalProperty : 'totalCount',
id : 'inbox'
}, [/*{
name : 'priority',
mapping : 'priority'
}, {
name : 'status',
mapping : 'status'
}, */{
name : 'subject',
mapping : 'subject'
}, {
name : 'from',
mapping : 'from'
}, {
name : 'date',
mapping : 'udate'
}, {
name : 'size',
mapping : 'size'
}
]),

remoteSort: true
});

var cm = new Ext.grid.ColumnModel([{
header : '<img src="'+domain+'/images/icons/bullet_blue.png" style="width: 16px; height: 16px; cursor: help;" title="Priotet" alt="Priotet"/>',
dataIndex : 'priority',
width : 25
},{
header : '<img src="'+domain+'/images/icons/email.png" style="width: 16px; height: 16px; cursor: help;" title="Status" alt="Status"/>',
dataIndex : 'status',
width : 25
},{
id : 'messsages-head-subject',
header : 'Emne',
dataIndex : 'subject',
sortable : true
},{
header : 'Afsender',
dataIndex : 'from',
width : 250,
sortable : true
},{
header : 'Dato / Klokken',
dataIndex : 'date',
width : 175,
sortable : true
},{
header : 'St

Animal
13 Jun 2007, 8:28 AM
It's up to the script on your server to look at the start and limit parameters and only send back the data requested.

DuGi
13 Jun 2007, 8:30 AM
So, when I make the HttpProxy call I automaticly sends $_POST['start'] AND $_POST['limit'] to the script?

And when I click the "next" button, the reloads the HttpProxy call with greater $_POST['start'] AND $_POST['limit'] ?

jsakalos
13 Jun 2007, 8:32 AM
Paging toolbar sends start:xxx, limit:yyy POST/GET variables. These say what the paging grid wants server to send. If server ignores 'em and sends all you've got that problem.

DuGi
13 Jun 2007, 8:35 AM
Fantastic!
Thanks to both of you, and wow you guys answer fast. I like ;D