Sencha Touch - RESTful load() 特定实例 URL 问题(商店/模型)

Posted

技术标签:

【中文标题】Sencha Touch - RESTful load() 特定实例 URL 问题(商店/模型)【英文标题】:Sencha Touch - RESTful load() specific instance URL problem (Store/model) 【发布时间】:2011-07-14 17:52:29 【问题描述】:

使用模型/存储对象中的其余代理加载特定实例(load() 函数)似乎存在问题。示例:

代码:

Ext.regModel('User', 
    fields: ['id', 'name', 'email'],

    proxy: 
        type: 'rest',
        url : '/users'
    
);

//get a reference to the User model class
var User = Ext.ModelMgr.getModel('User');

//Uses the configured RestProxy to make a GET request to /users/123
User.load(123, 
    success: function(user) 
        console.log(user.getId()); //logs 123
    
); 

此代码复制自 Sencha touch 的 API。生成的 URL 是 http://localhost/users?_dc=... 而不是所需的(和记录的)url http://localhost/users/123。

在使用带有参数的 store.load 时也会发生这种情况。

我在这里做错了吗? 谢谢 T

【问题讨论】:

【参考方案1】:

它接缝 id 参数已记录但未实现。这已在 sencha 论坛 [link] 中讨论过。在 #8 和 #13 中写了一些不完整的修复。

【讨论】:

以上是关于Sencha Touch - RESTful load() 特定实例 URL 问题(商店/模型)的主要内容,如果未能解决你的问题,请参考以下文章