How to add wordWrap to curvature GridColumn

Today I decided to test the source datagrid instead of mx: Datatagrid. But the problem arises: I did not find the wordWrap option, do you know how to solve this?

<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;

thank

+5
source share
4 answers

The original poster did not select an answer. I'm going to combine the previous two into one super answr !: P

You can enable word wrap in all columns in a Spark DataGrid with the rowHeight variable:

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

Or you can enable word wrap in a separate column using the wrap wrap property in the default GridColumn renderer:

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

Also, in the Grid Column example, I recommend setting the width if you want to prevent horizontal scrollbars:

<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>

, true , , .

+8

[]

, MX DataGridColumn, Spark GridColumn. ...

DataGridItemRenderer , true. , variableRowHeight true...

MXML, :

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

Prior to flex4.6 there is no s : DataGridItemRenderer, but there is mx : DataGridItemRenderer. Thus, the code will look like this:

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

All Articles