PDA

View Full Version : GridPanel + PagingToolBar Problem - Need Direction



s.m.srinivas
5 Nov 2009, 12:26 PM
Hi All,

I am using GridPanel With PagingToolBar with both using same store [Max limit set to 100]. I have custom server calls made from javascript [Using third party tool] & then when the response comes back, I load the data to the store using "loadData" function of store.

Now if I have to implement Pagination using the above setup what should I do? [Help or Direction or Guide to plugin or way to resolve will be of great help]. Please note that I can't use ExtJS built-in server request [Reader] features of ExtJS due to limitations[requirement].

Below is sample code which I am using [Included only required part of code not all]


var resultsStore = new Ext.data.JsonStore({
autoLoad : true,
fields : fields, //Array of field name
proxy : new Ext.data.MemoryProxy([])
});

var pagingToolbar = new Ext.PagingToolbar({
store: resultsStore,
displayInfo: true,
pageSize: 100,
prependButtons: true
});

var resultPanel = new Ext.grid.GridPanel({
enableHdMenu : false,
store: resultsStore,
columns: columns, //Columns defintion array
stripeRows: true,
title: 'Results',
region: 'center',
margins : '0 0 0 0',
header : true,
border: true,
bbar: pagingToolbar
});

In the response function I have below line to load data objects/ records [JSON objects]


resultPanel.getStore().loadData(rows,false);

carol.ext
5 Nov 2009, 12:32 PM
I do not understand. You ARE using a Reader, JsonStore uses a JsonReader.

What requirement prevents you from calling load instead of loadData?

s.m.srinivas
5 Nov 2009, 3:51 PM
The requirement is as follows:

I have 2 Data Sources [DS1 & DS2]. The user enters the screen, sets some filters & hit go, now I need to call DS1 which yields in Result1. Result1 has to be runned through some Business logic[BL] & retrieve few parameters from it & then call DS2, which yields in Result2. Result2 has to be displayed in Grid.

Now when if there is a page change, then the above same procedure of hitting DS1 & then BL & then hit DS2 -> put result in Grid has to be done.

And so if I use default reader's load function which would take in base param's & probably url etc.. for which it would make request, which in my case would not be suitable.

If I am wrong then, guide me, what is the better solution for this kind of situation.