PDA

View Full Version : Grid paging toolbar is not coming first time



vnaren100
13 Oct 2010, 3:08 PM
Hi ,

i am trying to create grid with paging toolbar. first time when i call the below function paging toolbar is not coming up and if i click second time the paging toolbar is coming .

Can some one help me to fix the issue .



var store;
var grid;

function loadgr(){

store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
method: 'GET',
prettyUrls: false,
url: 'sendTwoPaging2.jsp'
}),
reader:new Ext.data.JsonReader({
totalProperty:'total',
root:'rows',
id:'schedule',
fields:['organization', 'my_id','schedule','myDate']
}),
remoteSort:true
});

var cm = new Ext.grid.ColumnModel([
{header:'organization', width:120, sortable:false, dataIndex:'organization',menuDisabled:'true'},
{header:'my_id', width:120, sortable:false, dataIndex:'my_id'}
]);
cm.defaultSortable = false;

grid = new Ext.grid.GridPanel({
el:'pagingJson-grid',
store=store,
cm:cm,
viewConfig:{
forceFit:true
},
title:' grid title',
width:500,
autoHeight : true,
loadMask:true,
frame:false,
columnLines : true,
header : false,
headerAsText : false,
stripeRows : true,
sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
bbar:new Ext.PagingToolbar({
pageSize:10,
store=store,
displayInfo:true,
displayMsg: 'total{2} {0} - {1}',
emptyMsg:'no data'
})
});
grid.on('rowclick',function(grid, w, h) {
rclick(grid,w,h);
});
grid.render();
store.load({params:{start:0, limit:10}});
}