我创建的 JsonRest 存储如下所示
var questionBaseURL = "/" + contextName + "/service/questions/" + projectId + "/";
var questionStore = new dojo.store.JsonRest({
target: questionBaseURL,
handleAs: 'json',
idProperty: 'questionId'
});
questionStore = new dojo.store.Observable(questionStore);
var memoryStore = new dojo.store.Memory();
var questionCacheStore = new dojo.store.Cache(questionStore, memoryStore);
我用来渲染到如下创建的网格中
var CustomGrid = declare([OnDemandGrid, Keyboard, Selection]);
var questionGrid = new CustomGrid({
store: questionCacheStore,
columns: [
editor({
label: "Questions",
field: "question",
editor: "text",
editOn: "dblclick",
sortable: true,
autoSave:true
})
],
selectionMode: "single",
cellNavigation: false
}, "questions");
questionGrid.startup();
questionGrid.renderArray(questionArray);
数据在网格中正确填充。现在,由于使用“编辑器”,我可以在网格中编辑填充的数据。我不确定如何准确检测数据是否已被编辑(脏数据)以及调用哪种方法将更新的数据传回服务器。我找不到任何简单的文档。所以任何帮助表示赞赏。提前致谢