PDA

View Full Version : Problem with Store and XMLReader/Writer



b.wust
17 Mar 2011, 2:34 AM
Hello,

i'm using a store to load/save data. when creating a new record
in the store and then call save i always 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.


Here is the Code for my store and XMLReader/Writer:


var dependencyStore = new Ext.data.Store({
autoLoad : true,
autoSave : false,
proxy : new Ext.data.HttpProxy({
api:
{
read: dependenciesURL+"&t="+new Date().getTime(),
create: savedependenciesURL+"&t="+new Date().getTime(),
destroy: deldependenciesURL+"&t="+new Date().getTime()
},
method:'POST'
}),
reader: new Ext.data.XmlReader({
root: 'Links',
record: 'Link',
idPath: "Id",
successProperty: 'success',
fields : [
{name:'Id', type : 'int', mapping: 'Id'},
{name:'From', type : 'int', mapping: 'From'},
{name:'To', type : 'int', mapping: 'To'},
{name:'Type', type : 'int', mapping: 'Type'}
]
}),
writer: new Ext.data.XmlWriter({
listful: true,
encode: true,
writeAllFields: true,
xmlEncoding: "utf-8"
}),
listeners: {
exception : function() {
console.info(arguments);
}
}
});


XML that is sended to Server:


<?xml version="1.0" encoding="utf-8"?>
<Link>
<From>22</From>
<To>21</To>
<Type>3</Type>
</Link>


Server response XML:


<?xml version="1.0" encoding="utf-8"?>
<Links>
<success>true</success>
<Link>
<From>22</From>
<To>21</To>
<Type>3</Type>
<Id>209</Id>
</Link>
</Links>


I think it has something to do with the phantomId that is not correctly replaced with the record id
that server is sending back.

anyone has a idea ?