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);
私の場合、これは失敗します。グリッドでは問題ないように見えますが、実際には 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.... }
}
}
});