【问题标题】:flex return rowIndex from button in datagrid componentflex从datagrid组件中的按钮返回rowIndex
【发布时间】:2013-08-19 21:56:45
【问题描述】:

您好,当我连续单击一个按钮时,我试图传递 rowindex,数据值返回正确的信息,但 rowIndex 没有返回任何内容。

<mx:AdvancedDataGridColumn headerText="EDIT" showDataTips="false" editable="true">
    <mx:itemRenderer>
      <fx:Component>
            <mx:HBox horizontalAlign="center" verticalAlign="middle">
        <s:Button label="Edit" id="editGeo" click="{outerDocument.onClick(data, rowIndex)}"/>
        </mx:HBox>
    </fx:Component>
    </mx:itemRenderer>
</mx:AdvancedDataGridColumn>

谢谢!

【问题讨论】:

    标签: apache-flex datagrid return components row


    【解决方案1】:

    我很惊讶您提供的代码不会引发错误。

    您需要访问listData.rowIndex。 listData 应该是AdvancedDataGridListData 类的一个实例。

    <s:Button label="Edit" id="editGeo" click="{outerDocument.onClick(data, listData.rowIndex)}"/>
    

    由于 HBox 没有 listData 属性,因此您可能必须自己实现它才能传入数据。这样就足够了:

    [Bindable]
    public var listData:BaseListData;
    

    我已经有一段时间没有深入研究 MX 组件了,所以我对最后一部分的记忆有点生疏。

    【讨论】:

      【解决方案2】:

      除了第一个答案,当你的数据网格有垂直滚动条时,尽量不要使用listData.rowIndex,因为rowIndex只是显示当前可见行的索引。

      尝试使用数据网格的DataProvider中的当前对象索引。

      【讨论】:

        猜你喜欢
        • 2011-05-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2010-11-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-12-02
        相关资源
        最近更新 更多