有两个grid,分别有两个store与其对应,目前实现了表格间数据拖拽,就是官方提供的例子,dnd_grid_to_grid.js
现在有个问题,该如何判断第二个grid是否有变化呢?
例如,页面打开后,左边10条 右边5条,左右相互拖拽一条,记录数都不变,但是已经不是原来的记录了。或者从一个grid中拖走一条,再把它拖回来,相当于没变化这都怎么处理啊。
其实就是each一下,然后做下面处理:
Store2.add(record);
Store1.remove(record);
这样是自动commitChanges了么?
用getModifiedRecords得到的总是0
添加和删除record是不会写入modified的,只有编辑的才会。
就你那个例子里面,监听add和remove事件就ok了.
Store
add : ( Store this, Ext.data.Record[] records, Number index )
Fires when Records have been added to the Store
Listeners will be called with the following arguments:
this : Store
records : Ext.data.Record[] The array of Records added
index : Number The index at which the record(s) were added
remove : ( Store this, Ext.data.Record record, Number index )
Fires when a Record has been removed from the Store
Listeners will be called with the following arguments:
this : Store
record : Ext.data.Record The Record that was removed
index : Number The index at which the record was removed
监听store的事件,如datachanged,add,remove,update
监听store的事件,如datachanged,add,remove,update