开发者

How to define additional parameters in Dojo's JsonRestStore (dojox.data.JsonRestStore)?

I'm working on dojox.data.JsonRestStore in conjunction with dojox.grid.DataGrid to access a R开发者_C百科EST API which has an authentication process similar to OAuth where query parameters are signed by a Shared Secret.

For example, getting a list of books might look like this. GET http://testserver.com/api/book/?aaa=111&bbb=222&apiKey=123123&apiSign=A62D34764EFF12242341

Please note apiSign is hash string generated from concatenated string of all parameters and their values. Meaning I must apply this logic after JsonRestStore finishes setting up its own parameters.

How can I prepare these parameters? From what I could find, defining a custom service function seems to be one of the solutions but couldn't find good documentation on the topic. Extending JsonRestStore's _doQuery() function appears to be another solution but not sure if that's the right one.

If someone can point me to the right direction, I would really appreciate it.

Thanks!


Try using setStore() on the grid and adding the parameters you need.

For example,

myGrid.setStore(myStore, '?aaa=', '111');

I am pretty sure that this works after the store has loaded, but it looks like it refreshes the store. I'm using this to add extra "filter" parameters that my REST service uses to limit what information is returned; it works for me because once I add the parameters the user expects the data to reload.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜