PDA

View Full Version : How type of data must I put in my store? (array doesn't works, ArrayReader either)



samax
15 Jun 2009, 11:58 PM
Hello,
I've a problem with using a static store. I must use it for my fields, which are from different types. At first, I've my fields config files filled with all parameters (I cannot do it otherwise for some reasons), and then, I put the data of the store. I tried it:
With dataArray an array of type {'data': ['test', 'test2']}:
field.store.loadData(dataArray)
With dataArray an array of type ['test', 'test2']:
field.store.data = dataArray
With dataArray an array of type {'data': ['test', 'test2']}:
var arrayReader = new Ext.data.ArrayReader({root: 'data', recordType: 'array'});field.store.data = (arrayReader.readRecords(dataArray));

But no solution works. In the 1st solution, the result of the load of the data is simply invisible, in the 2nd solution, the error I have is "data.each is not a function" (I have compared my store with a working one, and effectively, in the data of the second, it has a "each" function, and many others, while the first contains only one function, "remove"). Lastly, with the 3rd solution, I get the error that "this.recordType is not defined".

Does someone has an idea of what must I use to fill my store's data?
Thank you.

Animal
16 Jun 2009, 12:05 AM
With dataArray an array of type {'data': ['test', 'test2']}


But that's not an Array though is it? It's an object.

This is an Array:



[['test', 'test2'],['row2 test', 'row2 test2']]

samax
16 Jun 2009, 12:40 AM
Thank you for your answer, but when I use this type of array with the loadData method of the store, I've a "root is undefined" error, while when I use the object, I get no error, but the result is invisible.

samax
16 Jun 2009, 1:02 AM
Please, it has been two days since I try to resolve this issue... I specify that I add the field to its container (a fieldset) after the load of its store, and that I do a doLayout on the fieldset after it.

Animal
16 Jun 2009, 1:11 AM
Two days?

How?

Here, it's as simple as this:

http://extjs.com/deploy/ext-3.0-rc2/docs/?class=Ext.data.ArrayReader