PDA

View Full Version : Pharsing Multy json elements



fatnjazzy
13 Oct 2010, 4:00 AM
Hi, I want to take some data from the server and eval it.
if i eval 1 element in the json, it works fine, but if i eval more, i get an error
this is the operation (Using jquery for the ajax):

,getColsFromServer : function(){
return [new Ext.grid.RowNumberer(),
Ext.util.JSON.decode('{"id":"id","dataIndex":"id","header":"ID","width":"20","sortable":"true","editor":{"xtype":"textfield","allowBlank":"false"}},{"dataIndex":"email","header":"Title","width":"120","sortable":"true","editor":{"xtype":"textfield","allowBlank":"false"}}')//,{"id":"pixels","dataIndex":"pixels","header":"pixels","width":"120","sortable":"true","editor":{"xtype":"textarea","allowBlank":"false"}})
];
} if you take a look, i have 2 columns id+email. using 2 columns return error: this.config[col] is undefined
[Break on this error] return this.config[col].width;
usind one column - works fine. Any idea?

13 Oct 2010, 7:10 AM
psssssssst. this is a "Sencha Touch" forum. Moving to Ext help.

Animal
13 Oct 2010, 7:16 AM
Looks like you haven't close the quote, so it's just an error.

You using IE6?

fatnjazzy
13 Oct 2010, 7:38 AM
no, it is not...
you will see that it marked with // in the middle

Jaitsu
13 Oct 2010, 7:40 AM
I know this is unrelated, but why are you using jQuery to post a request when you're using the Ext library?

Surely only one is needed.

Animal
13 Oct 2010, 7:56 AM
It's not valid JSON.


{...},{...}

is not valid.

Animal
13 Oct 2010, 7:57 AM
Jaitsu is correct.

jQuery is old school.

Have the first Store load return metadata, hook the metachange event, and configure your grid from that.

fatnjazzy
13 Oct 2010, 10:56 AM
I am using Jquery for Synced ajax call.
Can you please post some example? this kind of new to me.
Thanks for you help