perliu 2009-06-29 15:16
浏览 681
已采纳

如何判断store中的数据 发生了变化

有两个grid,分别有两个store与其对应,目前实现了表格间数据拖拽,就是官方提供的例子,dnd_grid_to_grid.js

现在有个问题,该如何判断第二个grid是否有变化呢?

例如,页面打开后,左边10条 右边5条,左右相互拖拽一条,记录数都不变,但是已经不是原来的记录了。或者从一个grid中拖走一条,再把它拖回来,相当于没变化这都怎么处理啊。

其实就是each一下,然后做下面处理:
Store2.add(record);
Store1.remove(record);

这样是自动commitChanges了么?

用getModifiedRecords得到的总是0

  • 写回答

3条回答 默认 最新

  • iteye_10013 2009-06-29 15:56
    关注

    添加和删除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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器