vendredi 20 février 2015

Store proxy loading data using Array Reader

Hello,

I am having problems loading an array of data from an external file into my store.


This is the file containing the data:


/data/contacts



Code:



[
["Lisa", "lisa@hotmail.com", "555-222-3333"],
["Bart", "bart@hotmail.com", "555-222-3333"],
["Homer", "homer@hotmail.com", "555-222-3333"],
["Marge", "marge@hotmail.com", "555-222-3333"]
]



This is my store:


Code:



Ext.define('MyApp.store.Contacts', {
extend: 'Ext.data.Store',
autoLoad: true,
alias: 'store.contacts',
model: 'MyApp.model.Contacts',

proxy: {
type: 'ajax',
reader: {
type: 'array'
}
url: '../data/contacts'
}
});

And I am getting this error:


Code:



[E] Ext.JSON.decode(): You're trying to decode an invalid JSON String: [
["Lisa", "lisa@hotmail.com", "555-222-3333"],
["Bart", "bart@hotmail.com", "555-222-3333"],
["Homer", "homer@hotmail.com", "555-222-3333"],
["Marge", "marge@hotmail.com", "555-222-3333"]


]



I can't change the format of the data file to have a proper JSON format. I thought using the array reader would be able to read the array of data.

Does anyone have any suggestions on what I am doing wrong, or what I should do?


Thanks.






Store proxy loading data using Array Reader

Aucun commentaire:

Enregistrer un commentaire