代码之家  ›  专栏  ›  技术社区  ›  Adnan

访问Flex中项目呈现器的属性

  •  0
  • Adnan  · 技术社区  · 16 年前

    我有一个datagrid,里面有一个组合框,比如;

       <mx:DataGrid editable="true"  x="72" y="10" id="dataGrid" creationComplete="dataGrid_creationCompleteHandler(event)" dataProvider="{getAllResult.lastResult}" height="178" width="896">
            <mx:columns>
                <mx:DataGridColumn headerText="STATUS" dataField="tooltip"/>
                <mx:DataGridColumn headerText="CUSTOM" editable="false" width="250" labelFunction="meAdnan"  >
                    <mx:itemRenderer>
                        <fx:Component className="myEditor2">
                            <mx:VBox height="100%" >
                                <mx:ComboBox  id="pickState" labelField="attname" 
                                              dataProvider="{parentApplication.getAllResult2.lastResult}" 
                                             >
                                </mx:ComboBox>
    
                            </mx:VBox>
                        </fx:Component>                 
                    </mx:itemRenderer>
                </mx:DataGridColumn>
            </mx:columns>
       </mx:DataGrid>
    

    现在,当我想从itemrended/组合框中访问一个函数时 parentApplication.funcName 但是另一种访问方式呢,如何从itemrenderer外部访问combobox的属性?我试过了 myEditor2.pickState 但它现在起作用了

    1 回复  |  直到 16 年前
        1
  •  1
  •   Amarghosh    16 年前

    parentApplication Application 类,它可能并不总是您想要访问的-如果您的 DataGrid 在扩展的组件中 Canvas . 使用 outerDocument itemRenderer . 所以应该是这样 outerDocument.funcName .

    public set data 方法并根据数据从那里对其进行操作。

    indexToItemRenderer 方法获取对给定索引处的当前项呈现器的引用。将其强制转换为正确的类型(或将其赋给类型为 Object )读它的名字 pickState 财产。

    推荐文章