#9242 closed defect (invalid)
fetch & fetchItemByIdentity have problems with the JsonRestStore
Reported by: | Kenny | Owned by: | Kris Zyp |
---|---|---|---|
Priority: | high | Milestone: | tbd |
Component: | DojoX Data | Version: | 1.3.0 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
If I create a JsonRestStore? and then just after that, I do a fetchItemByIdentity on it, the result will be all the items. The filter seems not be applied.
Same with the fetch function.
I tried also to do a simple fetch() before doing the fetchItemByIdentity.
I discovered that if I use the setTimeout function with at least 50ms (49 fail to work), then the fetchItemByIdentity function works good but the fetch still doesn't work, even with 1000ms.
I put a test case in the file attached.
Attachments (1)
Change History (6)
comment:1 Changed 12 years ago by
Changed 12 years ago by
Attachment: | jsonRestStore.html added |
---|
comment:2 Changed 12 years ago by
Owner: | changed from Jared Jurkiewicz to Kris Zyp |
---|
comment:3 Changed 12 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
This is because you are calling fetchItemByIdentity before the fetch response has been received. Consequently, there is no item with the given id available locally, so JsonRestStore? must do a request, which goes through your custom REST service function which returns the full array of items as the response to the request for "1". If you put fetchItemByIdentity in the onComplete callback for fetch, you should be able to retrieve the appropriate item.
comment:4 Changed 12 years ago by
Does JsonRestStore pass a parameter to the custom REST service specifying an id, which it's apparently ignoring?
comment:5 Changed 12 years ago by
Yes, the custom service is ignoring the id and always returning the same array in the example code.
Here is the Json I'm sending from a file called test.json on the same level: