div data-dojo-type="dojo/store/JsonRest" data-dojo-id="myData" data-dojo-props='target: "/rest/user?id="'/divdiv data-dojo-type="dojo/data/ObjectStore" data-dojo-id="myStore" data-dojo-props="objectStore: myData"/divtable data-dojo-type="do
<div data-dojo-type="dojo/store/JsonRest" data-dojo-id="myData" data-dojo-props='target: "/rest/user?id="'></div> <div data-dojo-type="dojo/data/ObjectStore" data-dojo-id="myStore" data-dojo-props="objectStore: myData"></div> <table data-dojo-type="dojox/grid/EnhancedGrid" data-dojo-id="myGrid" data-dojo-props='store: myStore, autoWidth:true, autoHeight:true, rowSelector: "20px", plugins:{ indirectSelection: {headerSelector:true, width:"40px", styles:"text-align: center;"}, pagination: true }, loadingMessage : "请稍候..."> <thead> <tr> <th field="name" width= "200px" >用户名</th> <th field="desc" width= "200px" >描述</th> </tr> </thead> </table>
function updateRow( ) { var index = myGrid.selection.selectedIndex; var item = myGrid.getItem(index); var store = myGrid.store; store.setValue(item, 'name', '新名字'); store.setValue(item, 'desc', '新描述'); }改变grid列值实际上是改变store的值,是对store的操作