View Full Version : PagingToolbar bug when loading store with params

24 Jun 2007, 9:07 AM
Hello !

I have a PagingToolbar which is added to grids header panel.

When I call Store with params I get NaN for number current page and number of records.

var params = {};
if (..) {
params.meta = 1;
var ds = ... Store(...);
ds.load({params: params});

When the store is loaded I get NaN.

After some debugging I came to this line in PagingToolbar.onLoad()

this.cursor = o.params ? o.params.start : 0;
Where code automatically assumes if params are defined then start param was specified.
Which I understand as a bug.

24 Jun 2007, 1:13 PM
In your reader for you store did you set the totalProperty value much like this?

var reader = new Ext.data.JsonReader({
root: 'Items',
totalProperty: 'TotalCount',
id: 'release_id'
}, Topic);

24 Jun 2007, 7:37 PM
PagingToolbar requires a 'start' parameter to be present in order to determine the current position in the dataset. Otherwise there is no way it could ever know.

25 Jun 2007, 12:18 AM
Thank you both for replying !

jon, for this error start param does not depend on totalProperty.

jack, there could be default value when there is no start param: start = 0.

I fixed it by specifying start param:
var params = {start: 0};