我們正在使用dojo JsonRest。無論何時我們需要用新數據刷新網格,dojo都會觸發兩個服務器調用。爲什麼Dojo grid.refresh正在調用另一個服務器?
以下是代碼。
var MyJsonRest = declare(JsonRest, {
get: function(id, options) {
return this.inherited(
arguments,
[id, lang.mixin(this.headers, options)]);
}
});
myDataStore = MyJsonRest({
target: someurl,
headers: {
'moduleUName': somemodulename
},
idAttribute: "id",
query: function(query, options) {
// some other code
}
});
myDataStore.get("", { paramName: paramValue }).then(function(result) { // this fires a request to server
gridObj.refresh(); // this fires same request 2nd time to the server
// if the gridObj.refresh() is commented out, then the grid does not displayes the new data.
});
感謝您的回答。如何在可觀察值中包含上面的代碼? – yetanothercoder
對不起,模糊的答案。我已經添加了一段代碼,假設您已經要求dojo/store/Observable – xangxiong
我嘗試了你所說的。但它不工作。沒有錯誤。但是現在它不會顯示具有初始數據的網格。 – yetanothercoder