views:

32

answers:

1

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?

+2  A: 

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();
}
Kenny Peng
This worked, thanks! One item: be sure to manually set the url back, otherwise other restful requests will send garbled urls to the server.
John Gordon