1. #1
    Ext User
    Join Date
    Jun 2009
    Posts
    84
    Vote Rating
    0
    samax is on a distinguished road

      0  

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

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


    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:
    1. With dataArray an array of type {'data': ['test', 'test2']}:
      Code:
      field.store.loadData(dataArray)
    2. With dataArray an array of type ['test', 'test2']:
      Code:
      field.store.data = dataArray
    3. With dataArray an array of type {'data': ['test', 'test2']}:
      Code:
      var arrayReader = new Ext.data.ArrayReader({root: 'data', recordType: 'array'});
    Code:
    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.

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,545
    Vote Rating
    64
    Animal is a jewel in the rough Animal is a jewel in the rough Animal is a jewel in the rough

      0  

    Default


    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:

    Code:
    [['test', 'test2'],['row2 test', 'row2 test2']]

  3. #3
    Ext User
    Join Date
    Jun 2009
    Posts
    84
    Vote Rating
    0
    samax is on a distinguished road

      0  

    Default


    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.

  4. #4
    Ext User
    Join Date
    Jun 2009
    Posts
    84
    Vote Rating
    0
    samax is on a distinguished road

      0  

    Default


    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.

  5. #5
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,545
    Vote Rating
    64
    Animal is a jewel in the rough Animal is a jewel in the rough Animal is a jewel in the rough

      0  

    Default


    Two days?

    How?

    Here, it's as simple as this:

    http://extjs.com/deploy/ext-3.0-rc2/...ta.ArrayReader

Thread Participants: 1