1 Reply Latest reply on Apr 15, 2011 10:42 AM by ssardar

    adanced datagrid column selector idea..??

    jahnvi25 Level 1

      so i have this requirement where i have many columns in advanced Datagrid with reasonable width, but i can not enable horizontal scrollbar at bottom.

      instead what our department wants is.. to have some radio button (number is dynamic based on how many columns are visible at a time) and user can select a particular radio button to make some columns visible , for example.. if i have first 3 columns visible, and i click on 2nd radio button then column 4,5,6 should be visible and so on... what is the better way to achieve this .. any idea how can i implement is best possible way ??

       

      Thanks

        • 1. Re: adanced datagrid column selector idea..??
          ssardar Level 1

          If I understand you correctly I think you want to use checkbox and not radio button.

           

           

          You also probably want to write a function to resize the column "width" based on how many are visible and the width of your ADG.

           

          But this is the easiest way to do this.

           

          ////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////

           

          <?xml version="1.0" encoding="utf-8"?>

          <mx:Application

           

          xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

           

           

          <mx:Script>

          <![CDATA[

           

           

          ]]>

           

          </mx:Script>

           

           

           

           

          <mx:AdvancedDataGrid id="adg1" x="87" y="197" id="adg1" designViewDataType="tree" width="533" height="257">

           

          <mx:columns>

           

          <mx:AdvancedDataGridColumn headerText="Column 1" dataField="col1" visible="{cb1.selected}"/>

           

          <mx:AdvancedDataGridColumn headerText="Column 2" dataField="col2" visible="{cb1.selected}"/>

           

          <mx:AdvancedDataGridColumn headerText="Column 3" dataField="col3" visible="{cb1.selected}"/>

           

          <mx:AdvancedDataGridColumn headerText="Column 4" dataField="col1" visible="{cb2.selected}"/>

           

          <mx:AdvancedDataGridColumn headerText="Column 5" dataField="col2" visible="{cb2.selected}"/>

           

          <mx:AdvancedDataGridColumn headerText="Column 6" dataField="col3" visible="{cb2.selected}"/>

           

          <mx:AdvancedDataGridColumn headerText="Column 7" dataField="col1" visible="{cb3.selected}"/>

           

          <mx:AdvancedDataGridColumn headerText="Column 8" dataField="col2" visible="{cb3.selected}"/>

           

          <mx:AdvancedDataGridColumn headerText="Column 9" dataField="col3" visible="{cb3.selected}"/>

           

          </mx:columns>

           

          </mx:AdvancedDataGrid>

           

          <mx:CheckBox id="cb1" x="87" y="98" label="Checkbox"/>

           

          <mx:CheckBox id="cb2" x="87" y="128" label="Checkbox"/>

           

          <mx:CheckBox id="cb3" x="87" y="158" label="Checkbox"/>

           

          </mx:Application>

           

           

          ////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////