Set the properties of object, as shown below.

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

-abdul


-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of yaagcur
Sent: Wednesday, October 12, 2005 11:13 AM
To: flexcoders@yahoogroups.com
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 flexcoders@yahoogroups.com, "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: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]
On
> Behalf Of Tracy Spratt
> Sent: Tuesday, October 11, 2005 5:24 PM
> To: flexcoders@yahoogroups.com
> 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: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]
On
> Behalf Of Deepa Subramaniam
> Sent: Tuesday, October 11, 2005 6:54 PM
> To: flexcoders@yahoogroups.com
> 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: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]
On
> Behalf Of yaagcur
> Sent: Tuesday, October 11, 2005 2:20 PM
> To: flexcoders@yahoogroups.com
> 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 --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/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