Well in my example I create a new DataGridColumn object to add to the
DataGrid. So all the properties available to any DataGridColumn
(headertext, width, resizable, etc) can be set directly on the new
DataGridColumn object once it has been created. 

var col:Object = new DataGridColumn("bool");
col.width=150;
col.headerText = "foo";
dg.addColumnAt(0, col);

-deepa 

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of yaagcur
Sent: Wednesday, October 12, 2005 11:13 AM
To: [email protected]
Subject: [flexcoders] Re: Hiding a datgrid column

Thanks guys. All your points were very helpful

One more thing. If I use Deepa's solution how do I change the
attributes of the column e.g headertext, width 


--- In [email protected], "Abdul Qabiz" <[EMAIL PROTECTED]> wrote:
>
> Performance wise, removing the DataGrid column, as Deepa showed, might
> be relatively more efficient. Where as having column with zero-width
> might still take memory..
> 
> 
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED]
On
> Behalf Of Tracy Spratt
> Sent: Tuesday, October 11, 2005 5:24 PM
> To: [email protected]
> Subject: RE: [flexcoders] Hiding a datgrid column
> 
> As I recall, setting a column's width to zero works pretty well for
> hiding it.  I haven't tried this recently.
> 
> Tracy
> 
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED]
On
> Behalf Of Deepa Subramaniam
> Sent: Tuesday, October 11, 2005 6:54 PM
> To: [email protected]
> Subject: RE: [flexcoders] Hiding a datgrid column
> 
> Yes - You would want to do listen to your checkbox's click event and
> then programmatically add or remove columns by using the API provided
by
> the DataGrid component. 
> 
> Below is something very simple and not too reusable, but you get the
> point..
> 
> <mx:Script>
> import mx.controls.gridclasses.*;
> 
> var dp:Array = [{label:"label1", data:"data", bool:true},
> {label:"label2", data:"data", bool:true}, {label:"label3",
data:"data",
> bool:false}, {label:"label4", data:"data", bool:false}];
> 
> public function changeDGCols(e):Void
> {
>     if (e.target.selected)
>     {
>         var col:Object = new DataGridColumn("bool");
>         dg.addColumnAt(0, col);
>     }
>     if (!e.target.selected)
>     {
>         dg.removeColumnAt(0);
>     }
> }
> </mx:Script>
> <mx:CheckBox label="show boolean column"
click="changeDGCols(event);"/>
> <mx:DataGrid id="dg" dataProvider="{dp}" width="200">
>     <mx:columns>
>         <mx:Array>
>             <mx:DataGridColumn columnName="label" />
>         </mx:Array>
>     </mx:columns>
> </mx:DataGrid>
> 
> -deepa
> 
> -----Original Message-----
> From: [email protected] [mailto:[EMAIL PROTECTED]
On
> Behalf Of yaagcur
> Sent: Tuesday, October 11, 2005 2:20 PM
> To: [email protected]
> Subject: [flexcoders] Hiding a datgrid column
> 
> Is there any wasy that a user can determine which columns are shown
> in a datagrid via, say, a check box control
> 
> 
> 
> 
> 
> 
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.com 
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 
> 
> 
> 
> 
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.com 
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 
> 
> 
> 
> 
> 
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.com 
> Yahoo! Groups Links
>







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links



 





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




Reply via email to