6 Replies Latest reply on Oct 4, 2010 12:25 PM by kminKeller

    Weird advanced data grid issue

    kminKeller-si5I0P Level 1

      I am using AdvancedDataGridGroup with AdvanceDataGridColumn in my application. I have multiple columns in each group. My requirement is to hide few of those datagrids when the user is not logged in and show those when logged in. I have added an empty column with width=1 and backgrounColor = white, to display the white lines to separate the groups. I set the visibility of those datagridcolumn to false using a bindable boolean variable from my model. When logging in I see all the datagrids and groups as desired. But when I log out, all those datagridcolumns dissappears except two of the empty columns which results in displaying those two vertical lines in the grid in logged out mode.

       

      Has anyone come across this issue? Maybe I am doing something wrong.

       

      I tried to set the min width and width to 0 to those empty column, didnt work. tried to set the background same as the background of the grid didnt work.

       

      Any suggestions will be appreciated. Thanks.

       

      KM

        • 1. Re: Weird advanced data grid issue
          jfb00 Level 3

          Hi,

          Can you elaborate a sample app so we can see the issue and test?

          Thanks

           

          Johnny

          Please rate my anwser

          • 2. Re: Weird advanced data grid issue
            kminKeller

            Hi Johnny, thanks for a response.

             

            Here is an example of my mxml file.

             

             

             

             

             

            <mx:AdvancedDataGrid

                 id="TestGrid"

                 width="{this.width}"

                 height="100%"

                 dataProvider="{dataprovider}" >

                 <mx:groupedColumns>

                      <mx:AdvancedDataGridColumnGroup

                           headerText="TEST1"

                           fontWeight="bold">

                           <mx:AdvancedDataGridColumn

                                id="test"

                                minWidth="75"

                                dataField="divTest"

                                headerText="Test"

                                textAlign="center" />

             

                           <mx:AdvancedDataGridColumn

                                id="test1"

                                minWidth="75"

                                dataField="divTest1"

                                headerText="Test1"

                                textAlign="center" />

             

                           <mx:AdvancedDataGridColumn

                                id="spacer"

                                minWidth="1"

                                width="1"/>

                      </mx:AdvancedDataGridColumnGroup>

                      <mx:AdvancedDataGridColumnGroup

                           headerText="TEST2"

                           fontWeight="bold"

                           visible="{isLoggedIn}">

                           <mx:AdvancedDataGridColumn

                                id="tes2t"

                                minWidth="75"

                                dataField="divTes2t"

                                headerText="Test2"

                                textAlign="center"

                                visible="{isLoggedIn}" />

             

                           <mx:AdvancedDataGridColumn

                                id="test3"

                                minWidth="75"

                                dataField="divTest3"

                                headerText="Test3"

                                textAlign="center"

                                visible="{isLoggedIn}" />

             

                           <mx:AdvancedDataGridColumn

                                id="spacer2"

                                minWidth="1"

                                width="1"

                                 visible="{isLoggedIn}"/>

                      </mx:AdvancedDataGridColumnGroup>

             

             

                 </mx:groupedColumns>

            </mx:AdvancedDataGrid>

             

             

            So if you look at the visible property of the second spacer is set to what ever the logged in status is.

             

             

            Scenario is when I first load up the page, it is in not logged in state. So only the first group TEST1 is displayed while TEST2 is not visible. There is a "Login" button which allows the user to a login page and the user enters the credentials. At this time the user see all the data in the AdvancedDataGrid as above. Then when the user logs out from that page, the default page will be displayed where you only see TEST1. Everything on TEST2 is set to not visible except the spacer. An extra spacer still shows up.

             

             

            I tried to listen to login logout events and set the visibility of the spacer to false and I trace it , I get it as false but the spacer still shows up. BTW this happens only when I log out from logged in state. when i first load up the page it is fine.

             

             

            I hope this helps you to understand what I am trying to do.

             

            Thanks again.

            • 3. Re: Weird advanced data grid issue
              jfb00 Level 3

              HI,

              I see what is the issue.

              Instead of changing the value in the visible property try to change the column property at the time of the handler get the result like:

              private function result(event:ResultEvent):void{

                   if (login){

                        test2.visible = true;
                        test3.visible = true;
                        spacer2.visible = true;

                   }else{

                        test2.visible = false;
                        test3.visible = false;
                        spacer2.visible = false;

                   }

              }

               

              I think you will get the idea.

              Regards

               

              Johnny

              Please rate my answer

              • 4. Re: Weird advanced data grid issue
                kminKeller Level 1

                Thanks again for the response Johnny.

                 

                I have already tried that but didn't work.

                 

                I have taken a different approach to manually create the whole data grid instead of using MXML component. I created the advancedDtaGridColumnGroup and added columns based on the user login status. It didn't solve the problem either. I am just wondering if it is a kind of weird bug Flex has.

                 

                So now what I am doing is use itemRenderer for the spacer and use a HBox in the renderer and set the backgroundColor as 0xFFFFFF. This works but nt as desired. Coz now I dont see a continuous line going all the to the bottom of the datagrid instead I get a sort of like a dotted line coz there is a lil gap between the rows.

                 

                I hope you are understanding what I am trying to say.

                 

                KM

                • 5. Re: Weird advanced data grid issue
                  jfb00 Level 3

                  Somethig is wrong in your code somewhere because the solution that I give you works (If you want the code I can post that here)

                  Maybe you are not firing the return function after logout.

                  Good luck

                   

                  Johnny

                  Please rate my answer

                  • 6. Re: Weird advanced data grid issue
                    kminKeller Level 1

                    Thanks Johnny.

                     

                    I have no doubt it should work but apparently it is not working for me. I have discussed this with couple of the flex architects who work with me and pretty much all of us think it is a bug in flex.

                     

                    I appreciate your effort to help me.

                     

                    KM