1 Reply Latest reply on Dec 19, 2009 5:17 AM by chris.huston.t10

    How to display two set of arrays in flex data grid?



      Please help me out to solve this problem


      There are two set of arrays listed in this page one set of array get displayed in the data field where else other doesnt what should i do. Though I used if ...else condition it doesnt take.


      It would be great if you could tell me to fix the solution




        • 1. Re: How to display two set of arrays in flex data grid?
          chris.huston.t10 Level 3

          Your if statement in the initData function only gets evaluated when the application starts so your trt dataProvider will always be train. Also, your if statement doesn't do anything once the dataProvider is set to train so it will never change to bang. If you want the DataGrid to change, you need to change the dataProvider in your myProc function. Finally, you have two event listenters for your myPro button. Either assign the listener in your initApp function or in MXML, not both.


          If you want to toggle back and forth between the two ArrayCollections, you could put your if statement in your myProc function like this:


                      private function myProc(event:MouseEvent):void
                          if(fromstn.text == "")
                              msgview.text="Please enter a station Name";
                              msgview.text =  "you entered " + fromstn.text + " Station." ;
                              trt.visible = true;
                          if (trt.dataProvider == train) {
                              trt.dataProvider = bang;
                          } else {
                              trt.dataProvider = train;
                      private function initApp():void