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;
Thanks
The original poster didn't select an answer I'm going to combine the previous two into one super answr! :P
You can enable word wrapping on all columns on the Spark DataGrid with variableRowHeight:
<s:DataGrid variableRowHeight="true">
</s:DataGrid>
Or you can enable word wrapping on an individual column by using the word wrap property on the default GridColumn item renderer:
<s:GridColumn dataField="fields.description" headerText="Description" >
<s:itemRenderer>
<fx:Component>
<s:DefaultGridItemRenderer wordWrap="true"/>
</fx:Component>
</s:itemRenderer>
</s:GridColumn>
Furthermore, in the Grid Column example I'd recommend setting a width if you want to prevent horizontal scroll bars:
<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>
I'm finding I have to set both variable row height to true and set the column width to get the behavior I'm looking for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With