PDA

View Full Version : grid with an array



christophe67
10 Aug 2012, 8:09 AM
hello,

Can anybody help me for this problem, when I create an array like this



myarray='['+msg+']'; store1.loadData(myarray);
the result of myarray is "[[45,' Test1'],[32,' Test2'],]
and I will load in a grid, this give me a bad result in the but when I read directly like this


var json1= [['45',' Test1'],['32',' test2'],];

this is running can anybody give the reason of this problem
Thank for your help


I can not understand this

willigogs
10 Aug 2012, 8:54 AM
Well you certainly shouldn't have the trailing comma after the last object...

i.e.


[[45,'Test1'],[32,'Test2']]

christophe67
10 Aug 2012, 8:58 AM
hello it's exactly the same with the comma and not

willigogs
10 Aug 2012, 9:03 AM
hello it's exactly the same with the comma and not
Maybe so, but any trailing commas in your code will break in old versions of IE.

The quotes surrounding your array might also be to blame. An array shouldn't have any quote marks, just objects.

e.g.


myarray = [msg];


If this doesn't resolve your issue, could you provide some additional code showing how this is implemented and loaded by the store?

scottmartin
10 Aug 2012, 9:22 AM
If you hard code the data into am array store does it work? have a look at:
http://dev.sencha.com/deploy/ext-4.1.0-gpl/examples/grid/array-grid.js

Do you receive any errors in the console?

As mentioned, you will need to provide a small demo if this does not help.

Scott.