qx.data.store.Jsonp:configureRequest未将请求作为参数
当像这样创建一个新的 qx.data.store.Jsonp 对象时...
var store = new qx.data.store.Jsonp(url, {
configureRequest: function(req) {
req.setParameter("key", "resources.appsrvs");
}
},"callback");
...委托函数 configureRequest 不会将请求作为参数获取,如 qx.data.storeInterface.IStoreDelegate 中所述。那么我该如何配置请求呢?
when creating an new qx.data.store.Jsonp object like this...
var store = new qx.data.store.Jsonp(url, {
configureRequest: function(req) {
req.setParameter("key", "resources.appsrvs");
}
},"callback");
... the delegate function configureRequest does not get the request as parameter as described in qx.data.storeInterface.IStoreDelegate. so how can i configure the request?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不幸的是,不是按照你想要的方式。 Jsonp 存储使用 ScriptLoader 对象,因为它是为跨域请求而设计的。因此,您的委托被使用,但传递给它的“req”对象实际上是一个 qx.io.ScriptLoader 实例。请参阅 ScriptLoader 以及 此处了解一些其他详细信息。
如果您不打算执行跨域请求,请考虑使用 qx.data.store.Json 代替。
Unfortunately, not in the way you intend. The Jsonp store uses a ScriptLoader object, as it is designed for cross-domain requests. So your delegate is used, but the 'req' object passed to it is actually a qx.io.ScriptLoader instance. Please see the API doc for ScriptLoader and also here for some additional details.
If you are not planning to do a cross-domain request, consider using qx.data.store.Json instead.
这可能与
qx.data.store.Jsonp
内部似乎使用qx.io.ScriptLoader
的事实有关,文档中说EXPERIMENTAL –尚未准备好投入生产
。另外,您没有指定您使用的 qooxdoo 版本。在 1.0.x 之前,我认为 qx.data.store.Jsonp 只是一个空存根。
你的函数被调用了吗?如果是的话,它会作为参数传递什么?
最后考虑提交错误报告。
It might have something to do with the fact that
qx.data.store.Jsonp
internally seems to useqx.io.ScriptLoader
for which the documentation saysEXPERIMENTAL – NOT READY FOR PRODUCTION
.Also you didn't specify which version of qooxdoo you use. Prior to 1.0.x I think
qx.data.store.Jsonp
is just an empty stub.Does your function get called at all? If yes what does it get passes as parameters?
And finally consider just filing a bug report.