PDA

View Full Version : Dynamic Grid pagination problem



veerai2i
17 Jan 2010, 9:53 PM
Hi ,

i am using dynamicJsonReader for rendering dynamic grid. i got all grid values. but while clicking pagination each time Grid is creating newly at bottom.

i tried with following code.

var cm;
var grid;
var rowIndex;
var ds = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url:'grid/radaptiveGrid.action?method=showExtSecuredGrid&gridName=<%= request.getParameter("gridName") %>&formName=<%= request.getParameter("formName")%>'}),
reader: new Ext.data.DynamicJsonReader({root:'results'})
});
ds.on('load', function() {
// Reset the Store's recordType
ds.recordType = ds.reader.recordType;
ds.fields = ds.recordType.prototype.fields;
// Create the grid
grid = new Ext.grid.EditorGridPanel({
ds: ds,
cm: new Ext.grid.DynamicColumnModel(ds),
sortable: true,
selModel: new Ext.grid.RowSelectionModel({singleSelect:true}),
clicksToEdit: 1,
loadMask: true,
bbar: new Ext.PagingToolbar({
store:ds,
pageSize:10,
displayInfo: true,//default is false (to not show displayMsg)
displayMsg: 'Displaying {0} - {1} of {2}',
emptyMsg: "No data to display",//display message when no records found
}),
tbar: [{
text: '<%= request.getParameter("gridName") %>'
}],
//this is the key to showing the GroupingStore
stripeRows: true,
trackMouseOver:true,
disableSelection:true,
// customize view config
viewConfig: {
forceFit:true,
enableRowBody:true,
},
autoHeight:true,
autoWidth:true
});

// var container=document.getElementById('extgrid');
// container.innerHTML="";
// render it
grid.render('extgrid');
grid.addListener('afteredit',handleEdit);

});


======

if i un comment below lines it works properly but pagination front and back not working due to no cache(new grid instace).

var container=document.getElementById('extgrid');
container.innerHTML="";

please find me where i did wrong.

thank you.