PDA

View Full Version : Problems related to the use of PagingToolBar



graycrow
17 Apr 2013, 4:30 PM
Hi~
I build a simple paging toolbar.
I would like to output the five data on a screen.
However, as shown in the figure below, the all data is output.
The second page is the same as the first page.
Where Am I wrong?
Please ask for help.
Thanks.



43190


Ext.onReady(function(){
var mm = Ext.data.Record.create([
{name: 'mb_id'},
{name: 'mb_sex'},
{name: 'mb_name'}
]);

var store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
method:'GET',
url:'./grid2.php'
}),
autoLoad:{
params:{
start:0,
limit:5
}
},

reader: new Ext.data.XmlReader(
{
record: 'Item'
}, [
'mb_id'
,'mb_sex'
,'mb_name'
]
)//,
//autoLoad: {params:{start: 0, limit: 5}}
});
store.load({
params: {
// specify params for the first page load if using paging
start: 0,
limit: 5,
// other params
foo: 'bar'
}
});

var grid = new Ext.grid.GridPanel({
renderTo: document.body,
frame:true,
title: 'information',
height:300,
width:516,
store: store,
columns: [
{header: "id", dataIndex: 'mb_id'},//, renderer: cover_image
{header: "sex", dataIndex: 'mb_sex',width:100},
{header: "name", dataIndex: 'mb_name',width:100}
],
bbar:new Ext.PagingToolbar({
store:store,
pageSize:5,
displayInfo:true
,
doLoad: function(start) {
var o = this.store.lastOptions.params;
var pn = this.getParams();
o[pn.start] = start;
o[pn.limit] = this.pageSize;
if (this.fireEvent('beforechange', this, o) !== false) {
this.store.load({
params: o
});
}
}
})
});
});




<?
header("Content-type: application/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";
echo "<root>";

for($i=0;$i<10;$i++){
echo "<Item>";
echo "<mb_id>".$i."</mb_id>";
echo "<mb_sex>".$i."</mb_sex>";
echo "<mb_name>".$i."</mb_name>";
echo "</Item>";
}
echo "</root>";
?>

mitchellsimoens
19 Apr 2013, 9:59 AM
Are you returning all data or just the page of data requested?