0 Replies Latest reply on Oct 6, 2010 2:47 PM by Muaddib2004

    DataGridColumn renderer issues after headerShift and state change

    Muaddib2004

      I have an mx:DataGrid component that is exhibiting some odd behavior.  I have defined two states in the containing parent.  I have also defined itemRenderers and text values for each of the DataGridColumns based on the state of the parent container, as follows:

       

      <s:Panel>

           <s:states>

                <s:State name="state1"/>

                <s:State name="state2"/>

                </s:states>

           <mx:DataGrid id="myGrid" width="100%" height="100%">

                <mx:columns>

                     <mx:DataGridColumn id="dgc1"

                        dataField="value1"

                        headerText="Static Header Text"

                        itemRenderer="com.renderers.StaticRenderer"/>

                     <mx:DataGridColumn id="dgc2"

                        dataField="value2"

                        headerText.state1="DGC2 State1 Header Text"

                       headerText.state2="DGC2 State2 Header Text"

                        itemRenderer.state1="com.renderers.value2.State1Renderer"

                       itemRenderer.state2="com.renderers.value2.State2Renderer"

                       excludeFrom="state1"/>

                     <mx:DataGridColumn id="dgc3"

                        dataField="value3"

                        headerText.state1="DGC3 State1 Header Text"

                       headerText.state2="DGC3 State2 Header Text"

                        itemRenderer.state1="com.renderers.value3.State1Renderer"

                       itemRenderer.state2="com.renderers.value3.State2Renderer"/>

                     <mx:DataGridColumn id="dgc4"

                        dataField="value4"

                        headerText.state1="DGC4 State1 Header Text"

                       headerText.state2="DGC4 State2 Header Text"

                        itemRenderer.state1="com.renderers.value4.State1Renderer"

                       itemRenderer.state2="com.renderers.value4.State2Renderer"

                       excludeFrom="state1"/>

                </mx:columns>

           </mx:DataGrid>

      </s:Panel>

       

       

      This all seems to work fine.  As the parent's 'currentState' property changes, the proper columns are included in the layout and the proper text and items are rendered properly.

       

      The issues seem to come in once the user starts to shuffle the columns around. More specifically when the user is in state2 (which has more columns visible) and begins to mix things up. Once the user re-arranges the columns (by dragging) and THEN tries to start flipping back and forth between states, odd things happen:

       

      1. columns that should be excluded seem to be visible (at least the header text would lead you to believe this)

      2. empty columns appear (header text value and no item data)

      3. columns header text values dissappear (no header values displayed)

      4. even columns (like dgc1) which have 'static' values are affected by this (blank values, not visible, etc).

       

      Has anyone experienced this problem, or does anyone have feedback on using this technique to hide/unhide columns in a DataGrid based on a components 'state' property?

       

      Thanks,

      Muad'Dib