PDA

View Full Version : Grid paging with JSON



dflkid
14 Nov 2006, 2:40 PM
I'm having some trouble getting the grid to render now that I switch to the JSON data model from XML and adding paging. Everything was working with XML, but I thought I would see if JSON would speed things up, along with paging. Well now the grid doesn't render, and the little "refresh" button on the toolbar just spins and spins. What am I missing? The bulk of my code is below...


//Set up remote data format
var urlSchema = {
root: 'CDRLs',
totalProperty: 'TotalCount',
id: 'use-index',
fields: ['CDRLID','CDRLNUMBER','CDRLSUBTITLE','CDRLTYPE','SUBMITTALAUTHOR','EVENTENDDATE','FREQ','IPTABBREV','DAYSDUETODM','AuthorSubmitDate','DuetoCust','CustSubmitDate','StatusText']
};
urlDM = new YAHOO.ext.grid.JSONDataModel(urlSchema);
// initialize paging
urlDM.initPaging('cdrl_json.cfm', 10);
urlDM.setDefaultSort(urlCM, 1, 'ASC');
urlSM = new YAHOO.ext.grid.SingleSelectionModel();

urlGrid = new YAHOO.ext.grid.Grid('results', urlDM, urlCM);
urlGrid.render();

urlDM.loadPage(1);

//Attach a double-click listener to the grid
urlGrid.on('rowdblclick', this.showInTab, this, true);