有没有人知道/在EditorGridPanel中有一个移动行的工作示例(或者知道它为什么不适合我)?我找到了一些例子,我发现的例子使用了这种方法:
// calculate the new index, then remove the record from the store, and re-insert it at the new index
grid.getStore().remove(record);
grid.getStore().insert(index, record);
Run Code Online (Sandbox Code Playgroud)
在我的情况下,这失败了.它在网格中看起来不错,但实际上有2个DELETE http请求被发送到服务器,而没有PUT.当我重新加载页面时,这变得很明显 - 移动的行实际上已被删除.
他是我店的基本配置:
var remoteJsonStore = new Ext.data.JsonStore({
storeId: 'colStore',
autoDestroy: false,
autoSave: true,
proxy: new Ext.data.HttpProxy({url:'/exercises/collect/data_rows'}),
restful: true,
format: 'json',
disableCaching: false,
autoLoad: true,
writer: new Ext.data.JsonWriter({
encode: false
}),
root: 'data',
idProperty: 'data_row_id',
fields: recordFields,
baseParams:{section_id:GridUtils.properties[gridId]['section_id']},
listeners:{
exception:function(misc){
// stuff....
},
beforewrite:function(store, action, rs, options, arg){
this.baseParams["position"]=rs.rowIndex;
},
beforesave:function(store, data){
// stuff.... } …Run Code Online (Sandbox Code Playgroud)