【问题标题】:Slickgrid - How to update dataView with changed dataSlickgrid - 如何使用更改的数据更新 dataView
【发布时间】:2011-11-26 13:02:50
【问题描述】:

我正在使用grid.onBeforeEditCell 事件进行一键式YesNoCheckboxCellEditor。

不确定这是否是最好的方法,但这是我为此创建的代码: Slickgrid - One-click checkboxes?

这很好用,但是直接设置 data[] 数组似乎不会影响 dataView()。

我的理解是dataView和data是完全解耦的,所以当我有一个filtered view的时候,我的filtered viewport后面的数据会不正确。

基于我的代码sn-p,如何更新dataView中对应的单元格?

(我找到了 dataView.getItembyId 和 dataView.updateItem 方法,但不确定如何使用它们)

我也试过:dataView.refresh()、grid.invalidateRow()、grid.render()

顺便说一句,我正在关注这个例子:http://mleibman.github.com/SlickGrid/examples/example-header-row.html

【问题讨论】:

    标签: slickgrid


    【解决方案1】:

    使用 grid.onClick 代替 onBeforeEditCell。 请参阅http://mleibman.github.com/SlickGrid/examples/example7-events.html 示例。

    【讨论】:

    • 这个demo没有使用dataView
    • 如果是DataView,只需使用dataView.updateItem()而不是直接更新项目。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-27
    • 2015-09-28
    相关资源
    最近更新 更多