PDA

View Full Version : totalRowCount from JSON Data object in a GRID



lorenzo
8 Nov 2006, 9:42 AM
Hi Jack, i'm working on a grid using JSONDataModel.

Based on your exemple I wrote this code:


var dm = new YAHOO.ext.grid.JSONDataModel({
root: "results",
id: "id",
fields: array_campi
});

Where "array_campi" is an array build from other params.
Everithing works fine. The only problem I have is relate to the need of getting the total number of records from my dataset.

This is your exemple code about that:


dm.getTotalRowCount = function(){
return 500; // or whatever your count is
}

Is there a way to get the totalRowCount from my Data Object in JSON so I can use this number in my costum function dm.getTotalRowCount?

Something like "totalTag" for XMLDatamodel.

I need this value to complete the correct implementation of your paginating toolBar.
Thanks for your help and for your great job.
Lorenzo

jack.slocum
8 Nov 2006, 5:30 PM
You are looking for "totalProperty" added in one of the recent betas. It works the same as totalTag.

lorenzo
8 Nov 2006, 11:55 PM
Thanks Jack... everything works great.