PDA

View Full Version : BBar PagingToolbar not paging correctly



Chaoz
12 Aug 2010, 6:57 AM
Hi!
I have a problem with my PagingToolbar.... I'm currently retrieving an XML from my server having this sample format:



<Items>
<Total>100</Total>
<MyItem>
<Id>123</Id>
<Name>my name</Name>
</MyItem>
.
.
.
</Items>


and this is my code using ExtJS



var myStore= new Ext.data.Store({

url: '../GetList',

reader: new Ext.data.XmlReader({
record: 'MyItem',
id: 'Id',
totalRecords: 'Total'
}, [
'Id', 'Name'
])
});


var myGrid= new Ext.grid.GridPanel({
store: myStore,
columns: [
{header: "Name", width: 100, dataIndex: 'Name', sortable: true}
],
id: "nameGridId",
title: "Name List",
loadMask: true,
sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
forcefit: true,
//frame: true,
stripeRows: true,
iconCls: 'cog',
tbar: [{
text: 'Add',
handler : function(){

},
iconCls: 'add'
}, {
text: 'Edit',
handler : function(){

},
iconCls: 'edit'
}, {
text: 'View',
handler : function(){

},
iconCls: 'view'
}, {
text: 'Delete',
handler : function(){

},
iconCls: 'delete'
}, '-', 'Search:'],

// paging bar on the bottom
bbar: new Ext.PagingToolbar({
pageSize: 30,
store: myStore,
displayInfo: true,
displayMsg: 'Displaying names {0} - {1} of {2}',
emptyMsg: "No names to display"
})
});


myStore.load({params:{start:0, limit:30}});


Instead of getting something like...
Page 1 of 4 and Displaying names 1 - 30 of 100
I would get
Page 1 of 1 and Displaying names 1 - 30 of 30


I don't get why this is happening... I have compared codes from my old 2.2 codes as well as the examples I see on the website and its roughly the same.

Hope you guys can help.

thanks!

P.s. just for extra info, I have this grid inside a card layout, inside the center panel on a viewport.