【问题标题】:Add TextArea to Datagrid in FLex 4在 Flex 4 中将 TextArea 添加到 Datagrid
【发布时间】:2012-07-18 07:34:45
【问题描述】:

我们在项目中使用 Flex 4。这是一项要求。我们有一个带有一些行和列的 AdvancedDataGrid 控件。有一个产品列。因为产品的数量比较多,所以我们希望它显示在一个 textArea 中。我们有一个产品列的渲染器。单击产品列后,此文本区域应在单击的列上方可见。

我在 ProductsRenderer.mxml 中尝试了以下代码。这里的 x 和 y 是任意的。当我单击该列时,我看不到任何文本区域。

    <fx:Declarations>   
        <parsley:Configure/>
</fx:Declarations>

    <fx:Script>
        protected function clickHandler(event:MouseEvent):void
        {
            var textArea:TextArea = new TextArea();
            textArea.height = 40;
            textArea.width  = 50;
            textArea.x = //get x for TextArea;
            textArea.y = //get y for TextArea;
            textArea.visible = true;
            textArea.setFocus();
            textArea.text = fProducts;
        }

    ]]>
    </fx:Script>

<s:VGroup id="Box"
              paddingBottom="0"
              paddingTop="5"
              horizontalAlign="left" height="100%">
        <s:Label id="productsData" top="0" left="0" right="0" bottom="0" width="100%" click="clickHandler(event)"/>
</s:VGroup>

这里应该怎么做才能让文本区域显示在网格上?谢谢

【问题讨论】:

    标签: flex4 textarea


    【解决方案1】:

    您没有将 textArea 添加到任何父容器。执行以下操作:

    protected function clickHandler(event:MouseEvent):void
            {
                var textArea:TextArea = new TextArea();
                textArea.height = 40;
                textArea.width  = 50;
                textArea.x = //get x for TextArea;
                textArea.y = //get y for TextArea;
                textArea.visible = true;
                FlexGlobals.topLevelApplication.addChild(textArea); //this could be something else, showing an example here.
                textArea.setFocus();
                textArea.text = fProducts;
            }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-03-06
      • 2011-07-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-19
      • 2010-12-11
      • 1970-01-01
      相关资源
      最近更新 更多