简体   繁体   中英

Flex Datagrid Column Align for numbers

I have a datagrid where I want to align certain columns in such a way that the text is center aligned(both headertext and data). When the data is numeric, I need to align in a way that it is right aligned, holding total column center align property. please see the pic.

格式

Here is an example with different styles in different columns.

<s:ArrayList>
    <s:GridColumn id="dgFamilyRegisterLine" width="30"
                  labelFunction="{dgFamily.getRowNumber(dgFamily.dataProvider)}"
                  sortable="false">
                        <s:itemRenderer>
                            <fx:Component>
                                <s:DefaultGridItemRenderer color="0x888888"
                                                           fontStyle="italic"
                                                           textAlign="right"/>
                            </fx:Component>
                        </s:itemRenderer>
                    </s:GridColumn>
    <s:GridColumn dataField="code" headerText="code" minWidth="250"/>
    <s:GridColumn dataField="designation" headerText="designation" minWidth="250"/>                     
    <s:GridColumn dataField="isEnabled" headerText="isEnabled" minWidth="70">
        <s:itemRenderer>
          <fx:Component>    
            <s:GridItemRenderer>
              <s:layout>
                <s:HorizontalLayout horizontalAlign="center" verticalAlign="middle"/>
              </s:layout>
              <s:Image visible="{(data.isEnabled=='1')?true:false}"
                                             source="@Embed(source='assets/images/check.png')"/>    
            </s:GridItemRenderer>
          </fx:Component>
        </s:itemRenderer>
    </s:GridColumn>
 </s:ArrayList>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM