View Full Version : Grid and invalid mappings

7 Oct 2009, 4:46 AM
Right now I am creating a JSonStore as follows:

var store = new Ext.data.JsonStore({
autoLoad: true,
proxy: new Ext.data.HttpProxy({url: 'xxxx.ui', method: 'GET'}),
baseParams: {"limit": ROW_LIMIT, "start": 0},
storeId: 'mainStore',
root: 'currentPageContents',
totalProperty: 'totalNumberItems',
idProperty: 'field1',
fields: [
{name:'field2', convert: function(v, rec) {
try { return rec.field2.subfield1; } catch (e) { return ""; }

My problem is that I would like to just create a field as follows:
field: [ 'field1', 'field2.subfield1' ]

If I create the field in this way, the grid no longer displays this row. I'm guessing that an exception is thrown while processing the row since the field2 isn't present (some kind of NullPointerException). Does anyone know of a cleaner approach than creating the convert function and wrapping the return in an exception handler? I just think this makes my code more difficult to read.


19 Oct 2009, 4:13 AM
What does theJSON look like?

19 Oct 2009, 4:13 AM
Btw, you don't need to create an HTTP proxy for the Json store. just set the url property.