PDA

View Full Version : Json Store, #realize Exception on creating new Data



BJochen
14 Oct 2010, 6:54 AM
Hi, perhaps anyone can help me.
I use a JSON Store to send and load Data from a local Backend. The loading works fine and the datas will be shown correct in my grid.

This is my store:


Xpiron.Kalender.Data.MyStore= new Ext.data.JsonStore({
id: 'behandlungsVorlagenStore',
idProperty: "ID",
root: "d.rows",
totalProperty: "d.results",
successProperty: "d.success",
autoSave: true,
proxy: new Ext.data.HttpProxy({
headers: { 'Content-type': 'application/json' },
api: {
create: { url: Xpiron.Kalender.Settings.MainServer + 'Behandlungen.asmx/create', method: 'GET' },
read: { url: Xpiron.Kalender.Settings.MainServer + 'Behandlungen.asmx/read', method: 'GET' },
update: { url: Xpiron.Kalender.Settings.MainServer + 'Behandlungen.asmx/update', method: 'GET' },
destroy: { url: Xpiron.Kalender.Settings.MainServer + 'Behandlungen.asmx/destroy', method: 'GET' }
}
}),
writer: new Ext.data.JsonWriter({
encode: true,
writeAllFields: false
}),
fields: [
{ name: 'ID', mapping: 'ID', type: 'int' },
{ name: 'Salon', mapping: 'MandID', type: 'int'},
{ name: 'Name', mapping: 'Name', type: 'string'},
{ name: 'Kuerzel', mapping: 'Kuerzel', type: 'string'},
{ name: 'Notiz', mapping: 'Notiz', type: 'string'}
]
});


When i create new data, they will be send to server and the Server send the folloing response:


{"d":
{"__type":"KalenderTest.JsonMantel",
"success":true,
"rows":[{"ID":46,"MandID":0,"Name":"test","Kuerzel":"test","Notiz":null,"Dauer":0,"Typ":0
,"SkillID":0,"ServiceID":0}],
"results":1,
"message":"Done"}
}

But then i get an exception: uncaught exception: Ext.data.DataReader: #realize was called with invalid remote-data. Please see the docs for DataReader#realize and review your DataReader configuration.

Any one an idea? Need more information?

BJochen
15 Oct 2010, 12:10 AM
okay i got it.
the Store ID muss be declared with "storeId: 'behandlungsVorlagenStore'" ... the id and the idProperty are used in same way as i seed in the source!
And so my ID was always set null because ext tried to access the id field with wring informations...