PDA

View Full Version : ExtJS 3.1.1 PagingToolbar problem: not going to next page



JohnnyDelft
26 Feb 2010, 8:53 AM
I (newbie on ExtJS) have a problem with the PagingToolbar in a Xml-based grid, made with ExtJS 3.1.1.
Loading of the data is correct, I get and see the first 20 records, the number of pages seems to be correct and the total is also correct. Still, clicking on the 'next'-button does not bring me to the second page, I stay in page 1. The grid seems to refresh (I briefly see a spinner) but in Firebug I cannot see a request to the server.
And the alert after the load always shows '0' instead of the totalCount...

What am I doing wrong?

Code:


Ext.onReady(function(){

// For testing locally in Firefox
// In about:config signed.applets.codebase_principal_support must be set to true
netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');

// create the Data Store
var store = new Ext.data.XmlStore({
// load using HTTP
url: 'myDataStore.php',
autoLoad: true,

// records will have a "CREmployee" tag
record: 'CREmployee',
idProperty: 'employeeID',
totalProperty: 'totalCount',
method: 'POST',
externalSort: true,
baseParams: {
template: 'objects2.xml',
entity : 'CREmployee',
pwd : '*******',
show : [ 'employeeID', 'sortName', 'emailAddress' ],
start : 0,
limit : 20
},
fields: [
// set up the fields mapping into the xml doc
{ name: 'Naam', mapping: 'sortName'},
'emailAddress', {name:'employeeID', type: 'int'}
]
});

// create the grid
var grid = new Ext.grid.GridPanel({
store: store,
columns: [
{header: "Naam<br>Status", width: 120, dataIndex: 'Naam', sortable: true},
{header: "E-mailadres<br>&nbsp;", width: 180, dataIndex: 'emailAddress', sortable: true},
{header: "ID<br>&nbsp;", width: 100, dataIndex: 'employeeID', sortable: true}
],

renderTo:'example-grid',
width:420,
height:300,
title: 'Kandidaten',

bbar: new Ext.PagingToolbar({
pageSize: 20,
store: store,
displayInfo: true,
displayMsg: 'Kandidaat {0}-{1} van {2}',
emptyMsg: "Niets gevonden"
})
});

store.load({params:{start:0, limit:20}});
alert(store.getTotalCount());
});The XML looks like this:


<?xml version="1.0" encoding="utf-8"?>
<array count="119597">
<totalCount>119597</totalCount>
<CREmployee id="3605">
<employeeID>3605</employeeID>
<sortName>Quist, Theo</sortName>
</CREmployee>

... (total of 20 CREmployee records) ...

<CREmployee id="216140">
<employeeID>216140</employeeID>
<sortName>HEbiknietlekkerpuhuhuhuh</sortName>
</CREmployee>
</array>