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



 







------------------------ 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