前端之家收集整理的这篇文章主要介绍了
dojo小例子(10)改变grid选中行的列值,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
<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的操作