You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Tom Chiverton <tc...@extravision.com> on 2013/04/11 18:54:01 UTC

Over ridding the default header names in DataGrid

In the Spark Data Grid, how can I over ride the generated column header 
names (assuming my dataProvider is an array of Object) ?
I had a look in the source, but couldn't see where this is assigned to 
the labelDisplay skin part ?
-- 
extravision Signature
*Tom Chiverton* | Lead Developer | Extravision
*T:* 0161 817 2922 | *W:* www.extravision.com 
<http://www.extravision.com> | *T:* twitter.com/extravision 
<http://twitter.com/extravision> | *E:* tchiverton@extravision.com 
<ma...@extravision.com>
.
.
  A fresh approach to email marketing

.
Registered in the UK at : 107 Timber Wharf, 33 Worsley Street, 
Manchester, M15 4LD. Registration number: 05017214 VAT: GB 824 5386 19

Disclaimer: This e-mail is intended solely for the person to whom it is 
addressed and may contain confidential or privileged information. If you 
have received it in error please notify us immediately and destroy this 
e-mail and any attachments. In addition, you must not disclose, copy, 
distribute or take any action in reliance on this e-mail or any 
attachments. Any views or opinions presented in this e-mail are solely 
of the author and do not necessarily represent those of Extravision Ltd. 
E-mail may be susceptible to data corruption, interception, unauthorised 
amendment, viruses and delays or the consequences thereof. Accordingly, 
this e-mail and any attachments are opened at your own risk.


Re: Over ridding the default header names in DataGrid

Posted by Lee Burrows <su...@leeburrows.com>.
The spark datagrid has a columns property which is an IList 
(ArrayCollection i think) of DataGridColumn objects - each 
DataGridColumn has a headerText property which you can set


On 11/04/2013 17:54, Tom Chiverton wrote:
> In the Spark Data Grid, how can I over ride the generated column 
> header names (assuming my dataProvider is an array of Object) ?
> I had a look in the source, but couldn't see where this is assigned to 
> the labelDisplay skin part ?


-- 
Lee Burrows
ActionScripter


Re: Over ridding the default header names in DataGrid

Posted by Jonathan Campos <jo...@gmail.com>.
On Thu, Apr 11, 2013 at 3:05 PM, Tom Chiverton <tc...@extravision.com> wrote:

> I do, but my dataProvider is totally dynamic. Looks like I'll have to
> update the (computed) columns property when new data or columns arrive...


The default looks at the object and makes a column per property on the
first row of your IListCollection. Which is good and bad. It is good if you
data is well structured. But if you have new properties beyond the first
row then they aren't given columns.

I've had many clients need the "super dynamic well laid out" datagrid and
in the end I made it where the middle tier sends the data and some
information about how the columns should be created. That way they could do
things like dynamic coloring, aligning, human-readable labels, hidden
columns, etc etc etc. You get the idea.

Depending on how dynamic you need to be you may end up with a similar
solution. Ultimately I created a VO that basically matched all the options
for the datagrid column and the middle tier completely drove the datagrid.

-- 
Jonathan Campos

Re: Over ridding the default header names in DataGrid

Posted by Tom Chiverton <tc...@extravision.com>.
On 04/11/2013 06:00 PM, Kessler CTR Mark J wrote:
> Do you mean like just the headerText of the gridColumns?
>
I do, but my dataProvider is totally dynamic. Looks like I'll have to 
update the (computed) columns property when new data or columns arrive...

-- 
Tom


RE: Over ridding the default header names in DataGrid

Posted by Kessler CTR Mark J <ma...@usmc.mil>.
Do you mean like just the headerText of the gridColumns?

<s:DataGrid>
    <s:columns>
        <s:ArrayList>
            <s:GridColumn dataField="VeryLongIDName" headerText="ID" />
            <s:GridColumn dataField="EmailAddress" headerText="Email" />
        </s:ArrayList>
    </s:columns>
</s:DataGrid>

-Mark

-----Original Message-----
From: Tom Chiverton [mailto:tc@extravision.com] 
Sent: Thursday, April 11, 2013 12:54 PM
To: users@flex.apache.org
Subject: Over ridding the default header names in DataGrid

In the Spark Data Grid, how can I over ride the generated column header 
names (assuming my dataProvider is an array of Object) ?
I had a look in the source, but couldn't see where this is assigned to 
the labelDisplay skin part ?
-- 
extravision Signature
*Tom Chiverton* | Lead Developer | Extravision
*T:* 0161 817 2922 | *W:* www.extravision.com 
<http://www.extravision.com> | *T:* twitter.com/extravision 
<http://twitter.com/extravision> | *E:* tchiverton@extravision.com 
<ma...@extravision.com>
.
.
  A fresh approach to email marketing

.
Registered in the UK at : 107 Timber Wharf, 33 Worsley Street, 
Manchester, M15 4LD. Registration number: 05017214 VAT: GB 824 5386 19

Disclaimer: This e-mail is intended solely for the person to whom it is 
addressed and may contain confidential or privileged information. If you 
have received it in error please notify us immediately and destroy this 
e-mail and any attachments. In addition, you must not disclose, copy, 
distribute or take any action in reliance on this e-mail or any 
attachments. Any views or opinions presented in this e-mail are solely 
of the author and do not necessarily represent those of Extravision Ltd. 
E-mail may be susceptible to data corruption, interception, unauthorised 
amendment, viruses and delays or the consequences thereof. Accordingly, 
this e-mail and any attachments are opened at your own risk.