PDA

View Full Version : JsonStore - no runtime complaints, has data but grid does not render



KingKahn
26 Apr 2009, 6:35 PM
Guys,
I am using a JsonStore object in a component that extends the GridPanel. My server side code returns 102 records. The server code returns the Json string (I have tested it with JSON.parse and the string is in proper format so the Json parser can decode it). My assumption here is that when I use a JsonStore object I do not have to call JSON.parse. Am I correct? The issue here is that the grid does not render and I do not have any runtime issues. What could be the cause? Here is the code



Ext.ns('PreRegister');
Ext.BLANK_IMAGE_URL = '/ExtJS/resources/images/default/s.gif';
PreRegister.Grid = Ext.extend(Ext.grid.GridPanel, {
initComponent: function() {
var action = new Ext.ux.grid.RowAction({
iconCls: 'xxx'
});
var config = {
store: new Ext.data.JsonStore({
id: 'preRegStore',
proxy: new Ext.data.HttpProxy({
url: '/Calendar/previewAttendanceInfo.ashx/ProcessRequest',
method: 'GET'
}),
//PROXY
baseParams: {
EventSessionId: document.getElementById('ctl00$contentHolder$hfSessionId').value,
registeredOnly: '1'
},
totalProperty: 'total',
root: 'result',
autoLoad: true,
id: 'ContactId',
fields: [{
name: 'ContactId'
},
{
name: 'LastName',
type: 'string'
},
{
name: 'FirstName',
type: 'string'
},
{
name: 'Status',
type: 'string'
},
{
name: 'IsUnder18',
type: 'string'
},
{
name: 'attendedAnother',
type: 'string'
},
{
name: 'EventRegsId',
type: 'string'
}]
}) //store
,
LoadMask: true,
columns: [{
id: 'ContactId',
header: "ContactId",
width: 100,
sortable: true,
dataIndex: 'ContactId'
},
{
header: "Last Name",
width: 100,
sortable: true,
dataIndex: 'LastName'
},
{
header: "First Name",
width: 100,
sortable: true,
dataIndex: 'FirstName'
},
{
header: "Status",
width: 100,
sortable: true,
dataIndex: 'Status'
},
{
header: "IsUnder18",
width: 100,
sortable: true,
dataIndex: 'IsUnder18'
},
{
header: "attendedAnother",
width: 100,
sortable: true,
dataIndex: 'attendedAnother'
},
{
header: "Event Regs Id",
width: 100,
sortable: true,
dataIndex: 'EventRegsId'
},
action] // columns end
,
cm: new Ext.grid.ColumnModel([{
id: 'ContactId',
header: "ContactId",
width: 100,
sortable: true,
dataIndex: 'ContactId'
},
{
header: "Last Name",
width: 100,
sortable: true,
dataIndex: 'LastName'
},
{
header: "First Name",
width: 100,
sortable: true,
dataIndex: 'FirstName'
},
{
header: "Status",
width: 100,
sortable: true,
dataIndex: 'Status'
},
{
header: "IsUnder18",
width: 100,
sortable: true,
dataIndex: 'IsUnder18'
},
{
header: "attendedAnother",
width: 100,
sortable: true,
dataIndex: 'attendedAnother'
},
{
header: "Event Regs Id",
width: 100,
sortable: true,
dataIndex: 'EventRegsId'
},
action]) // colModel
} // config
Ext.apply(this, Ext.apply(this.initialConfig, config));
PreRegister.Grid.superclass.initComponent.apply(this, arguments);
} // function
});
Ext.reg('preRegGrid', PreRegister.Grid);

KingKahn
26 Apr 2009, 6:57 PM
{\"total\":\"106\",\"results\":[{\"ContactId\":\"C1239866922\",\"FirstName\":\"Tim\",\"LastName\":\"Albers\",\"Status\":\"Registered\",\"Under18\":\"\",\"EventRegsId\":\"E1239866925\",\"attendedAnother\":\"\"},
{\"ContactId\":\"C1239821568\",\"FirstName\":\"Lee\",\"LastName\":\"Barnholtz\",\"Status\":\"Registered\",\"Under18\":\"\",\"EventRegsId\":\"E1239821573\",\"attendedAnother\":\"\"},
{\"ContactId\":\"C1239798158\",\"FirstName\":\"Robert\",\"LastName\":\"Betts\",\"Status\":\"Registered\",\"Under18\":\"\",\"EventRegsId\":\"E1239798163\",\"attendedAnother\":\"\"},
{\"ContactId\":\"C1238133233\",\"FirstName\":\"Cheryl\",\"LastName\":\"Bonham\",\"Status\":\"Registered\",\"Under18\":\"\",\"EventRegsId\":\"E1239805721\",\"attendedAnother\":\"DJWVH95DEH31\"},
{\"ContactId\":\"C1238133233\",\"FirstName\":\"Cheryl\",\"LastName\":\"Bonham\",\"Status\":\"Registered\",\"Under18\":\"\",\"EventRegsId\":\"E1239805721\",\"attendedAnother\":\"DJWVH95DEH31\"},
{\"ContactId\":\"C1239862564\",\"FirstName\":\"Garrick\",\"LastName\":\"Boyd\",\"Status\":\"Registered\",\"Under18\":\"\",\"EventRegsId\":\"E1239862569\",\"attendedAnother\":\"\"},
{\"ContactId\":\"C1237250926\",\"FirstName\":\"Dan\",\"LastName\":\"Bramer\",\"Status\":\"Registered\",\"Under18\":\"\",\"EventRegsId\":\"E1239874242\",\"attendedAnother\":\"F9ED1FLQ4GB4\"},
{\"ContactId\":\"C1239804332\",\"FirstName\":\"Jennifer\",\"LastName\":\"Brennan\",\"Status\":\"Registered\",\"Under18\":\"\",\"EventRegsId\":\"E1239804337\",\"attendedAnother\":\"\"},
{\"ContactId\":\"C1238818574\",\"FirstName\":\"Russell\",\"LastName\":\"Wray\",\"Status\":\"Registered\",\"Under18\":\"\",\"EventRegsId\":\"E1239804633\",\"attendedAnother\":\"ZBRR74CP7764\"}]}

evant
26 Apr 2009, 8:27 PM
Debug your code, put a loadexception event on the store.

KingKahn
26 Apr 2009, 10:13 PM
I have defined a loadException method as a listener and the code breaks into it. However all I get is [object] tags. Does the data look right? Do the escape characters in some shape or form are the culprits? Since the JsonStore object wraps the store and reader, I am assuming that it can parse my data. Correct?

Thanks

KingKahn
26 Apr 2009, 10:55 PM
{"results":[{"ContactId":"C1239669073","FirstName":"Farid","LastName":"Ahmad","Status":"Registered","Under18":null,"EventRegsId":"E1239669076","attendedAnother":""},{"ContactId":"C1239815547","FirstName":"Gwendolyn","LastName":"Arline-Moss","Status":"Registered","Under18":"F","EventRegsId":"E1239815552","attendedAnother":""},{"ContactId":"C1238413336","FirstName":"Anthony","LastName":"Artis","Status":"Registered","Under18":null,"EventRegsId":"EBLDP8IT5GRJ","attendedAnother":"53ON1I3LUCOD"},{"ContactId":"C1239899558","FirstName":"Audrey","LastName":"Beatty","Status":"Registered","Under18":null,"EventRegsId":"E1239899563","attendedAnother":""},{"ContactId":"C1239836423","FirstName":"Cascelia","LastName":"Bell","Status":"Registered","Under18":null,"EventRegsId":"E1239836428","attendedAnother":""},{"ContactId":"C1239875074","FirstName":"Sandra","LastName":"Burtch","Status":"Registered","Under18":null,"EventRegsId":"E1239875080","attendedAnother":""},{"ContactId":"C1239797044","FirstName":"David J","LastName":"Coleman","Status":"Registered","Under18":null,"EventRegsId":"E1239797050","attendedAnother":""},{"ContactId":"C1239850692","FirstName":"Nellie","LastName":"Coon","Status":"Registered","Under18":null,"EventRegsId":"E1239850697","attendedAnother":""},{"ContactId":"C1238463951","FirstName":"Guy","LastName":"Courter","Status":"Registered","Under18":null,"EventRegsId":"E1239892834","attendedAnother":"53ON1I3LUCOD"},{"ContactId":"C1238463951","FirstName":"Guy","LastName":"Courter","Status":"Registered","Under18":null,"EventRegsId":"E1239892834","attendedAnother":"53ON1I3LUCOD"},{"ContactId":"C1239851298","FirstName":"Karen","LastName":"Dettmer","Status":"Registered","Under18":null,"EventRegsId":"E1239851303","attendedAnother":""},{"ContactId":"C1236819948","FirstName":"Dale","LastName":"Eathorne","Status":"Registered","Under18":null,"EventRegsId":"E1239875960","attendedAnother":"11Q3CIHD2AQQ"},{"ContactId":"C1239807204","FirstName":"Ken","LastName":"Ellis","Status":"Registered","Under18":null,"EventRegsId":"E1239807210","attendedAnother":""},{"ContactId":"C1239845622","FirstName":"Angela","LastName":"Everhart","Status":"Registered","Under18":null,"EventRegsId":"E1239845627","attendedAnother":""},{"ContactId":"C1239845488","FirstName":"Deshoun","LastName":"Everhart","Status":"Registered","Under18":null,"EventRegsId":"E1239845493","attendedAnother":""},{"ContactId":"C1239809704","FirstName":"Dan","LastName":"Feig","Status":"Registered","Under18":null,"EventRegsId":"E1239809709","attendedAnother":""},{"ContactId":"C1239866097","FirstName":"Elaine","LastName":"Fennelly","Status":"Registered","Under18":null,"EventRegsId":"E1239866102","attendedAnother":""},{"ContactId":"C1239866097","FirstName":"Elaine","LastName":"Fennelly","Status":"Registered","Under18":null,"EventRegsId":"E1239866102","attendedAnother":""},{"ContactId":"C1239866089","FirstName":"James","LastName":"Fennelly","Status":"Registered","Under18":null,"EventRegsId":"E1239866094","attendedAnother":""},{"ContactId":"C1235845742","FirstName":"Vernon","LastName":"Ford","Status":"Registered","Under18":"F","EventRegsId":"E1239824080","attendedAnother":"81BZFINRJQJ1"},{"ContactId":"C1235845742","FirstName":"Vernon","LastName":"Ford","Status":"Registered","Under18":"F","EventRegsId":"E1239824080","attendedAnother":"81BZFINRJQJ1"},{"ContactId":"C1239831729","FirstName":"Michael","LastName":"Gardner","Status":"Registered","Under18":null,"EventRegsId":"E1239831734","attendedAnother":""},{"ContactId":"C1239803003","FirstName":"Thomas","LastName":"Grant","Status":"Registered","Under18":null,"EventRegsId":"E1239803008","attendedAnother":"16TEHMFKC4BY"},{"ContactId":"C1236826936","FirstName":"Erma","LastName":"Griffin","Status":"Registered","Under18":null,"EventRegsId":"E1239860285","attendedAnother":"11Q3CIHD2AQQ"},{"ContactId":"C1236826936","FirstName":"Erma","LastName":"Griffin","Status":"Registered","Under18":null,"EventRegsId":"E1239860285","attendedAnother":"11Q3CIHD2AQQ"},{"ContactId":"CIPVOEV8SK1U","FirstName":"monica","LastName":"haines","Status":"Registered","Under18":null,"EventRegsId":"EPMSJHNDJQAH","attendedAnother":"YHAI582JWGAN"},{"ContactId":"C1239816857","FirstName":"Gilbert","LastName":"Hairston","Status":"Registered","Under18":null,"EventRegsId":"E1239816862","attendedAnother":""},{"ContactId":"C1239815747","FirstName":"Evon","LastName":"Harris","Status":"Registered","Under18":null,"EventRegsId":"E1239815752","attendedAnother":""},{"ContactId":"C1239826243","FirstName":"Mitch","LastName":"Hodge","Status":"Registered","Under18":null,"EventRegsId":"E1239826248","attendedAnother":""},{"ContactId":"C1239875205","FirstName":"Rachel","LastName":"Hughes","Status":"Registered","Under18":null,"EventRegsId":"E1239875210","attendedAnother":""},{"ContactId":"C1239866926","FirstName":"Belinda","LastName":"Jackson-Laury","Status":"Registered","Under18":null,"EventRegsId":"E1239866931","attendedAnother":""},{"ContactId":"C1239815714","FirstName":"Cutina","LastName":"James","Status":"Registered","Under18":null,"EventRegsId":"E1239815719","attendedAnother":""},{"ContactId":"C1238434538","FirstName":"Katie","LastName":"Johnson","Status":"Registered","Under18":null,"EventRegsId":"E1239839251","attendedAnother":"53ON1I3LUCOD"},{"ContactId":"C1239816350","FirstName":"Lakischa","LastName":"Jordan","Status":"Registered","Under18":null,"EventRegsId":"E1239816355","attendedAnother":""},{"ContactId":"C1239806364","FirstName":"William D","LastName":"Jordan","Status":"Registered","Under18":null,"EventRegsId":"E1239806369","attendedAnother":""},{"ContactId":"C1239831684","FirstName":"Erik","LastName":"Kaiser","Status":"Registered","Under18":null,"EventRegsId":"E1239831689","attendedAnother":""},{"ContactId":"C1239846539","FirstName":"Sami","LastName":"Khal","Status":"Registered","Under18":null,"EventRegsId":"E1239846544","attendedAnother":""},{"ContactId":"C1239831783","FirstName":"Rodney","LastName":"Knoerr","Status":"Registered","Under18":null,"EventRegsId":"E1239831788","attendedAnother":""},{"ContactId":"C1239844136","FirstName":"Mark","LastName":"Kolenda","Status":"Registered","Under18":null,"EventRegsId":"E1239844141","attendedAnother":""},{"ContactId":"C1239520248","FirstName":"John","LastName":"Lambert","Status":"Registered","Under18":null,"EventRegsId":"E1239793020","attendedAnother":"FPJOITFJUUPH"},{"ContactId":"C1239520248","FirstName":"John","LastName":"Lambert","Status":"Registered","Under18":null,"EventRegsId":"E1239793020","attendedAnother":"FPJOITFJUUPH"},{"ContactId":"C1239520355","FirstName":"Renee","LastName":"Lambert","Status":"Registered","Under18":null,"EventRegsId":"E1239793004","attendedAnother":"FPJOITFJUUPH"},{"ContactId":"C1239806813","FirstName":"Sonya","LastName":"Lee","Status":"Registered","Under18":null,"EventRegsId":"E1239806818","attendedAnother":""},{"ContactId":"C1239792263","FirstName":"Mary","LastName":"Lenzi","Status":"Registered","Under18":null,"EventRegsId":"E1239792268","attendedAnother":""},{"ContactId":"C1237649294","FirstName":"Renee","LastName":"Lewis","Status":"Registered","Under18":null,"EventRegsId":"E1239836209","attendedAnother":"VU4ZDBZR59YU"},{"ContactId":"C1239798786","FirstName":"DEBRA","LastName":"LINN","Status":"Registered","Under18":null,"EventRegsId":"E1239798789","attendedAnother":""},{"ContactId":"C1238452583","FirstName":"David","LastName":"Lott","Status":"Registered","Under18":null,"EventRegsId":"E1239835705","attendedAnother":"53ON1I3LUCOD"},{"ContactId":"C1239797395","FirstName":"Tim","LastName":"Lynch","Status":"Registered","Under18":null,"EventRegsId":"E1239797400","attendedAnother":""},{"ContactId":"C6UJ9A009962","FirstName":"Robert","LastName":"Machala","Status":"Registered","Under18":" ","EventRegsId":"E1239799753","attendedAnother":"Q6UJ9A01BU4R"},{"ContactId":"C1239817806","FirstName":"Mark","LastName":"Mccoy","Status":"Registered","Under18":null,"EventRegsId":"E1239817811","attendedAnother":""},{"ContactId":"C1239874896","FirstName":"Fredrick","LastName":"Miller","Status":"Registered","Under18":null,"EventRegsId":"E1239874901","attendedAnother":""},{"ContactId":"C1237085977","FirstName":"James","LastName":"Miller","Status":"Registered","Under18":null,"EventRegsId":"E1239874976","attendedAnother":"WTHVXEF5MTDL"},{"ContactId":"C1237085977","FirstName":"James","LastName":"Miller","Status":"Registered","Under18":null,"EventRegsId":"E1239874976","attendedAnother":"WTHVXEF5MTDL"},{"ContactId":"C1239802475","FirstName":"Caldin","LastName":"Moore","Status":"Registered","Under18":null,"EventRegsId":"E1239802480","attendedAnother":""},{"ContactId":"C1236811140","FirstName":"Chris","LastName":"Morris","Status":"Registered","Under18":null,"EventRegsId":"E1239798542","attendedAnother":"11Q3CIHD2AQQ"},{"ContactId":"C1239810276","FirstName":"Reginald","LastName":"Morris","Status":"Registered","Under18":null,"EventRegsId":"E1239810282","attendedAnother":""},{"ContactId":"C1239441347","FirstName":"Edith","LastName":"Nortey","Status":"Registered","Under18":null,"EventRegsId":"MO4SYSWIDK5V","attendedAnother":"FPJOITFJUUPH"},{"ContactId":"C1239819201","FirstName":"Debbie","LastName":"Nuffer","Status":"Registered","Under18":null,"EventRegsId":"E1239819206","attendedAnother":""},{"ContactId":"C1239819451","FirstName":"Mark","LastName":"Nuffer","Status":"Registered","Under18":null,"EventRegsId":"E1239819456","attendedAnother":""},{"ContactId":"C1239808734","FirstName":"Gwendolyn","LastName":"Pace","Status":"Registered","Under18":null,"EventRegsId":"E1239808739","attendedAnother":""},{"ContactId":"C1239514362","FirstName":"Susan","LastName":"Payne","Status":"Registered","Under18":null,"EventRegsId":"E2XWHYSHW4IJ","attendedAnother":""},{"ContactId":"C1237641461","FirstName":"Conrad","LastName":"Pollard","Status":"Registered","Under18":null,"EventRegsId":"E1239836117","attendedAnother":"VU4ZDBZR59YU"},{"ContactId":"C1239844183","FirstName":"Linda","LastName":"Prince","Status":"Registered","Under18":null,"EventRegsId":"E1239844188","attendedAnother":""},{"ContactId":"C1239816009","FirstName":"Henry","LastName":"Reynolds","Status":"Registered","Under18":null,"EventRegsId":"E1239816014","attendedAnother":""},{"ContactId":"C1239816589","FirstName":"Diana","LastName":"Rocha","Status":"Registered","Under18":null,"EventRegsId":"E1239816594","attendedAnother":""},{"ContactId":"C1239802668","FirstName":"Wayne","LastName":"Smoot","Status":"Registered","Under18":null,"EventRegsId":"E1239802673","attendedAnother":""},{"ContactId":"C1239899832","FirstName":"Chris","LastName":"Szafran","Status":"Registered","Under18":null,"EventRegsId":"E1239899837","attendedAnother":""},{"ContactId":"C1239854070","FirstName":"Aleks","LastName":"Teske","Status":"Registered","Under18":null,"EventRegsId":"E1239854073","attendedAnother":""},{"ContactId":"C1236780868","FirstName":"Ralph","LastName":"Tibbs","Status":"Registered","Under18":null,"EventRegsId":"E1239871829","attendedAnother":"11Q3CIHD2AQQ"},{"ContactId":"C1236780868","FirstName":"Ralph","LastName":"Tibbs","Status":"Registered","Under18":null,"EventRegsId":"E1239871829","attendedAnother":"11Q3CIHD2AQQ"},{"ContactId":"C1239453244","FirstName":"John E.","LastName":"Tobin","Status":"Registered","Under18":null,"EventRegsId":"E1239887555","attendedAnother":"FPJOITFJUUPH"},{"ContactId":"C1239878027","FirstName":"Trinity","LastName":"Trotter","Status":"Registered","Under18":null,"EventRegsId":"E1239878032","attendedAnother":""},{"ContactId":"C6UJ9A00K0X3","FirstName":"Paul","LastName":"Waatti","Status":"Registered","Under18":" ","EventRegsId":"E1239810353","attendedAnother":"Q6UJ9A03U0CU"},{"ContactId":"C6UJ9A00K0X3","FirstName":"Paul","LastName":"Waatti","Status":"Registered","Under18":" ","EventRegsId":"E1239810353","attendedAnother":"Q6UJ9A03U0CU"},{"ContactId":"C1236770351","FirstName":"Brad","LastName":"Walker","Status":"Registered","Under18":null,"EventRegsId":"E1239798437","attendedAnother":"11Q3CIHD2AQQ"},{"ContactId":"C1236770351","FirstName":"Brad","LastName":"Walker","Status":"Registered","Under18":null,"EventRegsId":"E1239798437","attendedAnother":"11Q3CIHD2AQQ"},{"ContactId":"C1239808716","FirstName":"Stephanie","LastName":"Watkins","Status":"Registered","Under18":null,"EventRegsId":"E1239808721","attendedAnother":""},{"ContactId":"C1239809284","FirstName":"Brad","LastName":"Weber","Status":"Registered","Under18":null,"EventRegsId":"E1239809289","attendedAnother":""},{"ContactId":"C1239809284","FirstName":"Brad","LastName":"Weber","Status":"Registered","Under18":null,"EventRegsId":"E1239809289","attendedAnother":""},{"ContactId":"C1239800821","FirstName":"Jan","LastName":"Wheeler","Status":"Registered","Under18":null,"EventRegsId":"E1239800826","attendedAnother":""},{"ContactId":"C1239877250","FirstName":"John","LastName":"Williams","Status":"Registered","Under18":null,"EventRegsId":"E1239877256","attendedAnother":""},{"ContactId":"C1239844710","FirstName":"Andrew","LastName":"Wolfgram","Status":"Registered","Under18":null,"EventRegsId":"E1239844715","attendedAnother":""},{"ContactId":"C1239844747","FirstName":"Lisa","LastName":"Wolfgram","Status":"Registered","Under18":null,"EventRegsId":"E1239844752","attendedAnother":""}]}

evant
26 Apr 2009, 10:57 PM
So interrogate the error message. Note that the 4th parameter of the loadexception is an exception object.

campersau
26 Apr 2009, 11:08 PM
Maybe add success : true to your response:


{
success : true,
total : 123,
results : [...]
}

KingKahn
27 Apr 2009, 5:35 AM
This is just hilarious. My json object's root is called results and the definition for the root property was 'result' without an s!!!

KK