简体   繁体   English

Ext JS模型代理buildURL

[英]Ext JS model proxy buildURL

I am using REST proxies in my models. 我在模型中使用REST代理。 A model named community has a "hasMany" relationship to a model named Departments. 名为社区的模型与名为部门的模型具有“ hasMany”关系。

To retrieve the following records I simply call community.departments() which triggers the store load but with the wrong URL. 要检索以下记录,我只需调用community.departments()即可触发商店加载,但URL错误。 The communityId parameter is not being included. 没有包含communityId参数。

So I decided to build the URL I need, with the buildURL method. 因此,我决定使用buildURL方法构建所需的URL。 I need to pass the communityId property which is also the foreign key like this 我需要传递communityId属性,它也是这样的外键

/myapp/communities/{communityId}/Departments

but inside the buildUrl method there are no records beeing passes so again I cannot retrieve the communityId. 但是在buildUrl方法内部没有记录buildUrl通过,因此再次无法检索communityId。

The relations are set correctly. 关系设置正确。

Plese help and advise I am really stuck here. 请帮助并告知我,我真的被困在这里。

I can only support what Jaimie wrote (but still cannot comment ;-)). 我只能支持Jaimie撰写的内容(但仍然无法发表评论;-)。 There's a nice article on Skirtle's Den about custom proxies and buildUrl: http://skirtlesden.com/articles/custom-proxies 在Skirtle's Den上有一篇关于自定义代理和buildUrl的不错的文章: http ://skirtlesden.com/articles/custom-proxies

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM