Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 08-27-2006, 05:48 AM   #1
Registered User
Join Date: Aug 2006
Posts: 1
Default align DataGrid header differently than data

I am new to Flex and am trying to set the alignment on the header of a DataGrid to "center" and right-align the data in some of the columns but cannot get this to work. Any help is greatly appreciated. Here is what I have:

<?xml version="1.0"?>
<!-- DataGrid control example. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:XMLList id="employees">
            <name>Christina Coenraets</name>
            <email>[email protected]</email>
            <name>Joanne Wall</name>
            <email>[email protected]</email>
    <mx:Panel title="DataGrid Control Example" height="100%" width="100%" 
        paddingTop="10" paddingLeft="10" paddingRight="10">

        <mx:Label width="100%" color="blue"
            text="Select a row in the DataGrid control."/>

        <mx:DataGrid id="dg" width="100%" height="100%" rowCount="5" headerStyleName="headerStyle"  dataProvider="{employees}">
                <mx:DataGridColumn dataField="name" headerText="Name"/>
                <mx:DataGridColumn dataField="phone" headerText="Phone"/>
                <mx:DataGridColumn dataField="email" headerText="Email"/>
                <mx:DataGridColumn dataField="salary" headerText="Salary" textAlign="right"/>
actionscript_user is offline   Reply With Quote
Old 10-06-2006, 07:51 PM   #2
Registered User
Join Date: Oct 2006
Posts: 1

Just add the text-align property for each column and set the value right. or just add another style DataGrid{text-align: right;} for all the columns
cachanchan is offline   Reply With Quote
Old 03-14-2008, 07:29 AM   #3
Registered User
Join Date: Mar 2008
Posts: 2

cachanchan: the solution you suggested does not work. I am not quite sure if there is any solution to it.
sherazjamshed is offline   Reply With Quote
Old 03-14-2008, 07:47 AM   #4
Registered User
Join Date: Mar 2008
Posts: 2
Default Solution :

OOps !! no there is a simple solution...

sherazjamshed is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding data to a blank datagrid DekaFlash Components 2 01-03-2008 03:24 AM
Please help loading data/ datagrid ericb1 Components 1 11-22-2005 07:26 PM
data from shared object into datagrid not working gabrielthegrey Components 0 10-01-2005 12:24 AM
datagrid component does not show data alexandre_lab Components 2 02-28-2005 01:57 PM

All times are GMT. The time now is 07:06 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.