ExtJS - 带 json 存储的 DWR 代理?
我试图让 JsonStore
使用一个接受参数并异步执行的函数,但我不知道如何做到这一点。
myMethod
需要一个回调
,但是如何将回调数据绑定到JsonStore
?
store = new Ext.data.JsonStore({
proxy: new Ext.data.DirectProxy(
{
directFn:(new function(){return MyDwrService.myMethod('test')}),
}),
autoLoad:true,...
我尝试使用 DwrProxy
实现,但现在当我不将 fields
传递给 JsonReader
时,没有数据填充我的网格,并且当我 < em>do传递字段
,会创建一堆空白行。什么给?
store = new Ext.data.Store({
proxy: new Ext.ux.data.DwrProxy({
apiActionToHandlerMap:{
read: {
dwrFunction: MyService.myMethod,
getDwrArgsFunction: function() {
return ["testUser"]
}
}
}
}),
reader: new Ext.data.JsonReader({fields:myFields}),
autoLoad:true,
fields:myFields,
remoteSort:true
});
I'm trying to make a JsonStore
use a function that takes arguments and executes asynchronously, but I'm not sure how to do this.
myMethod
takes a callback
, but how do I tie the callback data to the JsonStore
?
store = new Ext.data.JsonStore({
proxy: new Ext.data.DirectProxy(
{
directFn:(new function(){return MyDwrService.myMethod('test')}),
}),
autoLoad:true,...
I tried using a DwrProxy
implementation, but now when I don't pass fields
to JsonReader
, no data populates my grid, and when I do pass fields
, a bunch of blank rows are created. What gives?
store = new Ext.data.Store({
proxy: new Ext.ux.data.DwrProxy({
apiActionToHandlerMap:{
read: {
dwrFunction: MyService.myMethod,
getDwrArgsFunction: function() {
return ["testUser"]
}
}
}
}),
reader: new Ext.data.JsonReader({fields:myFields}),
autoLoad:true,
fields:myFields,
remoteSort:true
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用启用了
JSONP
的DWR3
,您将不需要代理。Use
DWR3
withJSONP
enabled and you won't need a proxy.您肯定需要在阅读器中包含字段,但我不明白为什么有空白行。我很确定我们没有得到任何空记录 - 也许allowBlank:false可以将其排序..如果有任何用处,这是我们的代码:
You definitely need to include fields in the reader but I don't understand why there are blank rows. I'm pretty sure we don't get any empty records - maybe the allowBlank:false sorts it out.. if it's any use, this is our code: