English 中文(简体)
如何在 火花灰色上添加字词布
原标题:How to add wordWrap on spark GridColumn

Today, I decided to test spark datagrid instead of mx:Datatagrid. But a problem appear: I didn t found wordWrap option, do you know how to solve that?

<s:DataGrid id="scrollableDG" borderVisible="true"  editable="true"
                     width="100%" height="{bgSuivi.height-90-90}">

 //Setup columns for scrollable datagrid
    var gridColumn:GridColumn = new GridColumn();
    gridColumn.dataField="scRub2";
    gridColumn.headerText = "Rub1";
    gridColumn.width = 80;
    gridColumn.editable = true;
    columnLst.addItem(gridColumn);

    var gridColumn:GridColumn = new GridColumn();
    gridColumn.dataField="scRub3";
    gridColumn.headerText = "Rub1";
    gridColumn.width = 80;
    gridColumn.editable = true;
    columnLst.addItem(gridColumn);

    var gridColumn:GridColumn = new GridColumn();
    gridColumn.dataField="scRub4";
    gridColumn.headerText = "Rub1";
    gridColumn.width = 80;
    gridColumn.editable = true;
    columnLst.addItem(gridColumn);
    scrollableDG.columns = columnLst;

谢谢 谢谢

问题回答

原始海报没有选择一个答案 Im 将把前两个合并为一个 < engen@ em> super awr! : P

您可以启用以变量RowH8在 Spark DataGrid 上的所有列上换行的单词 :

<s:DataGrid variableRowHeight="true">
</s:DataGrid>

或者您可以通过在默认的 GridColumn 项转换器上使用单列的单行包换属性来启用单行包换单行:

<s:GridColumn dataField="fields.description" headerText="Description" >
    <s:itemRenderer>
        <fx:Component>
            <s:DefaultGridItemRenderer wordWrap="true"/>
        </fx:Component>
    </s:itemRenderer>
</s:GridColumn>

此外,在网格列示例Id中,如果你想防止水平滚动条,我建议设置宽度:

<s:GridColumn width="{dataGrid.width-column1.width-column3.width}" dataField="fields.description" headerText="Description" >
    <s:itemRenderer>
        <fx:Component>
            <s:DefaultGridItemRenderer wordWrap="true"/>
        </fx:Component>
    </s:itemRenderer>
</s:GridColumn>

我发现我必须把两个可变行高设置为真实, 并设置列宽以获得我所要寻找的行为 。

<强>[编辑

我最初的回答指的是MX DataGridColumn 组件,而不是Spark GridColumn 。 订正的答复...

网格的默认项目创建器是 DataGridTrojectRenderer , 它有一个要设置为真实的单词包换属性。 不确定, 但是您可能也必须设置网格的 可变RowH8 属性为真实的...

要在 MXML 中做到这一点, 它会看起来是这样的:

<s:DataGrid variableRowHeight="true">
    <s:itemRenderer>
        <fx:Component>
            <s:DataGridItemRenderer wordWrap="true" />
        </fx:Component>
    </s:itemRenderer>
</s:DataGrid>

flex4.6 之前,没有 s :DataGrid TimesRenderer,但有mx :DataGridTimesRenderer。 因此,代码是:

<s:GridColumn headerText="foo" labelFunction="fooLabelFunction">
    <s:itemRenderer>
        <fx:Component>
            <mx:DataGridItemRenderer wordWrap="true" />
        </fx:Component>
    </s:itemRenderer>
</s:GridColumn>




相关问题
Disable button tooltip in AS3

I want to disable the tooltip on certain buttons. The tooltip manager seems to be an all or nothing solution. Is it possible to disable the tooltip for just one or two buttons?

Multiple Remote call made simultenously

I was making multiple remote calls and they are done sequentially and when I am getting a result event back it s triggering calls to all the methods with ResultEvent as an argument . I am supposed to ...

Attaching a property to an event in Flex/AS3

I have a parameter that needs to be passed along with an event. After unsuccessful attempts to place it on the type by extending the class, I ve been advised in another SO question to write a custom ...

Clearing RSL in Cache

I have built a flex application which has a "main" project and it is assosciated with a few RSL s which are loaded and cached once i run my "main" application. The problem i am facing is that the ...

What s a good way of deserializing data into mock objects?

I m writing a mock backend service for my flex application. Because I will likely need to add/edit/modify the mock data over time, I d prefer not to generate the data in code like this: var mockData =...

AS3 try/catch out of memory

I m loading a few huge images on my flex/as3 app, but I can t manage to catch the error when the flash player runs out of memory. Here is the what I was thinking might work (I use ???? because i dont ...

热门标签