【问题标题】:Trigger an itemEditEnd event within the itemEditor在 itemEditor 中触发 itemEditEnd 事件
【发布时间】:2011-04-18 15:01:10
【问题描述】:

这对您的 DataGrid 专家来说可能很容易。我按照一个示例从行内动态地将行添加到 DataGrid

http://www.switchonthecode.com/tutorials/adding-dynamic-rows-to-flex-datagrid

我想要完成的调整是拥有一个自定义 itemEditor,它是一个带有两个 TextInputs 和一个 OK 按钮的表单。在我的一生中,我无法让那个按钮触发 DataGrid 的 itemEditEnd 事件,在我调用 destroyItemEditor 之前我有一些处理。我尝试自己直接调度事件,但在 DataGrid 的 updateDisplayList 中出现一个奇怪的错误,说editedItemPosition 为空(editedItemPosition.rowIndex)。有什么想法吗?

【问题讨论】:

    标签: apache-flex datagrid itemeditor


    【解决方案1】:

    itemEditEnd 将在您在项目编辑器外部单击时触发。如果是自己调度,需要在调度前将rowIndexproperty of the event设置为合适的值。

    【讨论】:

    • 我实际上设置了 rowIndex(和所有其他 DatGridEvent 属性),但一直收到奇怪的错误。
    【解决方案2】:

    我想出了“呃”的答案。基本上,在itemEditor 中使用listData.owner 获取对DataGrid 的引用,然后设置DataGrid 的editedItemPosition 和selectedIndex。这种方式让组件担心清理 itemEditor。

    var grid:DataGrid = listData.owner as DataGrid;
    grid.editedItemPosition = null;
    grid.selectedIndex = -1;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-06-16
      • 2011-06-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多