5 Replies Latest reply on Oct 10, 2012 7:26 AM by aciam70

    NavigatorContent problem

    aciam70

      Hello everyone,

      I'm using flex 4.5 and I have a problem with NavigatorContent.

      I have two NavigatorContents and on creation complete event I verified that the NavigatorContent not visible has the width property to zero.

      Only when it becomes visible width property is set correctly. Why does this happen?

       

      The NavigatorContent with width equal to zero has inside a data grid and its column widths are connected to container.  So I can not see the data grid correctly.

      Has anyone any suggestions to solve this problem?

      Thanks


      Andrea

        • 1. Re: NavigatorContent problem
          Abhishek Chaudhary Level 1

          You can bind datagrid width to navigator content's width.

          Are you trying to bind navigator content's width to dg column width?

          Please post code for further details.

           

          Regards,

          Abhishek Chaudhary
          InfoCepts | www.infocepts.com

          • 2. Re: NavigatorContent problem
            aciam70 Level 1

            Maybe I didn't explain well

            Here my code"

            -------------------------------

            <s:BorderContainer id="bc" width="50%" height="100%">

                <mx:ViewStack id="vsQ1" width="100%" height="96%">

                    <s:NavigatorContent id="ncQ1_1" width="100%" height="100%" >

                       

                        <s:layout>

                            <s:VerticalLayout horizontalAlign="center" verticalAlign="middle" />

                        </s:layout>

                    </s:NavigatorContent>

                   

                    <s:NavigatorContent id="ncQ1_2" width="100%" height="100%">

                        <components:CompDataGridQ1 id="compQ1" width="98%" height="98%"/>

                       

                        <s:layout>

                            <s:VerticalLayout horizontalAlign="center" verticalAlign="middle" />

                        </s:layout>

                    </s:NavigatorContent>

                       

                </mx:ViewStack>

               

                <s:HGroup width="100%" height="4%" >

                    <mx:ToggleButtonBar id="tbQ1"

                        toggleOnClick="true" itemClick="ItemClickHandler_tbQ1(event)" 

                        width="20%" height="100%" dataProvider="{vsQ1}"/>

                </s:HGroup>

               

                <s:layout>

                    <s:VerticalLayout verticalAlign="middle" horizontalAlign="center"/>

                </s:layout>

            </s:BorderContainer>

            ----------------------

             

            In "compQ1" I have a DataGrid that I can't set column width at creationComplete event

            Here the compQ1

             

            ----------------------

            <mx:DataGrid xmlns:fx="http://ns.adobe.com/mxml/2009"

                         xmlns:s="library://ns.adobe.com/flex/spark"

                         xmlns:mx="library://ns.adobe.com/flex/mx"

                         width="100%" height="100%"

                         dataProvider="{_acData}"

                         allowMultipleSelection="false">

               

                <fx:Declarations>

                    <!-- Place non-visual elements (e.g., services, value objects) here -->

                </fx:Declarations>

               

                <fx:Script>

                    <![CDATA[

                        import mx.collections.ArrayCollection;

                        import mx.events.FlexEvent;

                       

                        [Bindable]

                        private var _acData:ArrayCollection = new ArrayCollection();

                       

                       

                        public function InizializeColumnsWidth():void

                        {

                            c1.width = .55 * width;

                            c2.width = .45 * width;

                        }

                    ]]>

                </fx:Script>

               

                <mx:columns>

                    <mx:DataGridColumn id="c1" headerText="A" dataField="A" textAlign="left" />

                    <mx:DataGridColumn id="c2" headerText="B" dataField="B" textAlign="right"/>

                </mx:columns>

            </mx:DataGrid>

            -----------------------

             

            Thanks

            Andrea

            • 3. Re: NavigatorContent problem
              Abhishek Chaudhary Level 1

              So, you are not getting column widths in proportion of 55:45?

              • 4. Re: NavigatorContent problem
                Abhishek Chaudhary Level 1

                Are you missing out to call InizializeColumnsWidth func on creation complete?

                • 5. Re: NavigatorContent problem
                  aciam70 Level 1

                  I didn't post the creation complete function but I call InizializeColumnsWidth on it.