Extjs抛出异常“实现被无效的远程数据调用”成功创作纪录 [英] Extjs throws exception "realize was called with invalid remote-data" on successful creation of record
问题描述
未捕获的异常:
Ext.data.DataReader:#realize是
用无效的远程数据调用。
请参阅
的文档DataReader#实现并查看
DataReader配置。
我对于WTF这个错误的意思就是这样。任何人都有指针?
var proxy = new Ext.data.HttpProxy({
api:{
read:'../foo/bar.rnr',
create:'../foo/CreateBar.rnr',
update:'../foo/UpdateBar.rnr',
destroy:'../foo/DeleteBar.rnr'
}
});
var writer = new Ext.data.JsonWriter({
encode:true,
writeAllFields:true,
listful:true,
destroyRecord:function (rec){
return this.toHash(rec);
}
});
var store = new Ext.data.JsonStore({
autoLoad:true,
autoSave:false,
url:'../foo /bar.rnr',
method:'get',
baseParams:{Id:pageParameters.Id},
proxy:proxy,
writer:writer,
id:'id',
fields:[
{name:'Id',type:'int'},
{name:'Name',type:'string'},
{name:'Note',键入:'string',defaultValue:null}
]
});
我当前的回复看起来像这样,但这是经过大量的试错,所以它是prol prol ho。。。。。。>:::::::::}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
您需要在返回的json中返回记录
转到我的书Ext JS in Action中的以下示例,显示如何使用数据写入器进行粗暴动作。
http://extjsinaction.com/examples/chapter08/usingWriterWithHttpProxy.html
右键单击以插入新记录。从firebug观察Ajax req,你会看到它的行动。
I am using extjs in a monorail application. I am using a JsonStore to persist data back to my controller. I have read, update and delete working properly. But I cannot seem to figure out how to format my response back on creates. Currently, Firebug gives me the following error:
uncaught exception: Ext.data.DataReader: #realize was called with invalid remote-data. Please see the docs for DataReader#realize and review your DataReader configuration.
I am flummoxed about WTF this error means. Anyone have pointers? Relevant bits of code below:
var proxy = new Ext.data.HttpProxy({
api: {
read: '../foo/bar.rnr',
create: '../foo/CreateBar.rnr',
update: '../foo/UpdateBar.rnr',
destroy: '../foo/DeleteBar.rnr'
}
});
var writer = new Ext.data.JsonWriter({
encode: true,
writeAllFields: true,
listful: true,
destroyRecord: function(rec) {
return this.toHash(rec);
}
});
var store = new Ext.data.JsonStore({
autoLoad: true,
autoSave: false,
url: '../foo/bar.rnr',
method: 'get',
baseParams: { Id: pageParameters.Id },
proxy: proxy,
writer: writer,
id: 'Id',
fields: [
{ name: 'Id', type: 'int' },
{ name: 'Name', type: 'string' },
{ name: 'Note', type: 'string', defaultValue: null }
]
});
My current response looks like this, but this is after a lot of trial and error, so it is prolly hosed.
{"success":true,"message":"OK!","undefined":[]}
You'll need to return records in the returning json object.
Go to the following example from My book, Ext JS in Action, that shows how to use data writer for crud actions.
http://extjsinaction.com/examples/chapter08/usingWriterWithHttpProxy.html
Right click to insert a new record. Observe the Ajax req's from firebug and you'll see it in action.
这篇关于Extjs抛出异常“实现被无效的远程数据调用”成功创作纪录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!