JsonStore - 使用静态 URL 加载单个记录?

发布于 2024-09-28 07:15:58 字数 340 浏览 1 评论 0原文

所有,

我有一个 JsonStore 支持我的 extjs 应用程序中的表单面板。我想让 jsonStore 根据 id 值加载单个记录,但还没有找到一个好的方法来做到这一点,并且仍然保持 url 的安静。

我的第一次尝试是向 jsonstore load() 方法添加一个参数,其中包含 id。这只将 id 添加为请求参数,而不附加到 url:

http://my-app/users/?id=123

而不是我想要的:

http://my-app/users/123

有人可以帮我解决这个问题吗?

All,

I have a JsonStore backing a form panel in my extjs app. I want to have the jsonStore load a single record based on an id value, but haven't found a good way to do that yet, and still keep the url restful.

My first attempt was to add a param to the jsonstore load() method with the id in it. That only adds the id as a request param, not attached to the url:

http://my-app/users/?id=123

instead of what i want:

http://my-app/users/123

Can someone help me out with this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

╰沐子 2024-10-05 07:15:58

您可以手动构造存储区用于查询数据的 URL(通过它为 URL 创建的隐式 HttpProxy)。所以你的加载函数看起来像:

function store_refresh() {
  json_store.proxy.conn.url = 'http://my-app/users/' + user_id;
  json_store.reload();
}

You can manually construct the URL that the store uses to query for data (via the implicit HttpProxy it creates for the URL). So your loading function would look like:

function store_refresh() {
  json_store.proxy.conn.url = 'http://my-app/users/' + user_id;
  json_store.reload();
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文