PDA

View Full Version : My GridPanel won't load data from Store



JacobGu
15 Jul 2009, 10:03 AM
I'm not able to get my GridPanel to load data from its Store. I have other working GridPanels, but for some reason something about this one won't work. The Store's reader contains the remote JSON data, but it's not getting into the GridPanel. Here is the code:



var JobNotesStoreConfig = {
storeId: "JobNotesStore",
url: "/json/JobNotes.json",
baseParams: {
RepairID: ""
},
reader: new Ext.data.JsonReader({
id: "NoteID",
roots: "rows",
totalProperty: "totalRows",
idProperty: "NoteID"
}, [
{name: "NoteID", type: "int"},
{name: "NoteDate", type: "date", dateFormat:"Y-m-dTh:i:s"},
{name: "NoteUser", type: "string"},
{name: "NoteText", type: "string"}
])
};

Ext.onReady(function(){

var JobNotesGrid = new Ext.Panel({
id: "JobNotesGrid",
xtype: "grid",
renderTo: document.body,
frame: false,
cls: "PanelBorder",
store: new Ext.data.Store(JobNotesStoreConfig),
height: 70,
width: 370,
hideHeaders: true,
hidden: true,
disableSelection: true,
trackMouseOver: false,
deferRowRender: false,
columns: [
{header: "Date", dataIndex: "NoteDate", width: 100, renderer: NoteDate},
{header: "User", dataIndex: "NoteUser", width: 80},
{header: "Text", dataIndex: "NoteText", width: 180, renderer: NoteText}
],
bbar: new Ext.PagingToolbar({
id: "JobNotesPagingBar",
xtype: "paging",
pageSize: 2,
store: Ext.StoreMgr.get("JobNotesStore"),
displayInfo: true,
displayMsg: "Displaying {0} - {1} of {2} <b>Job Notes</b>",
emptyMsg: "No Job Notes",
style: "border:none"
})
});

JobNotesGrid.show();
JobNotesGrid.store.load({params:{start:0, limit:2, RepairID:0}});

});

JacobGu
15 Jul 2009, 10:08 AM
Typo: 'roots' instead of 'root'