Please ignore previous post.
Just noticed that in copy/paste of the code
I left the columns bit off.

<mx:columns>
{_displayColumns}
</mx:columns>

Sorry for the bandwidth,
Claude

--- In flexcoders@yahoogroups.com, "generalxxaxx" <[EMAIL PROTECTED]> wrote:
>
> I have created an mxml component for a datagrid.
> I wanted to switch the columns between three sets.
> 
> The code below is my attempt to accomplish this. A failed attempt.
> Is there something wrong with this approach?
> Or, is there perhaps something wrong with my implementation?
> 
> Regards,
> Claude
> 
> 
> <?xml version="1.0" encoding="utf-8"?>
> <mx:DataGrid xmlns:mx="http://www.adobe.com/2006/mxml";
>        horizontalScrollPolicy="auto" verticalScrollPolicy="auto"
>        editable="false" width="100%" height="100%">
>        <mx:Script>
>        <![CDATA[
>               import mx.controls.dataGridClasses.DataGridColumn;
> 
>               public function setDisplayColumns(which:String):void {
>                    switch (which)
>                    {
>                        case 1:
>                            _displayColumns = colSet1;
>                            break;
> 
>                        case 2:
>                            _displayColumns = colSet2;
>                            break;
> 
>                        case 3:
>                            _displayColumns = colSet3;
>                            break;
>                    }
> 
>               }
>       ]]>
>       </mx:Script>
>    
>       <mx:Array id="colSet1">
>               <mx:DataGridColumn dataField="field1" headerText="title1" />
>       </mx:Array>
>       <mx:Array id="colSet1">
>               <mx:DataGridColumn dataField="field2" headerText="title2" />
>       </mx:Array>
>       <mx:Array id="colSet3">
>               <mx:DataGridColumn dataField="field3" headerText="title3" />
>       </mx:Array>
> </mx:DataGrid>
>


Reply via email to