5 Replies Latest reply on Jun 20, 2006 6:31 AM by ntsiii

    DataGrid not displaying data (Flex 1.5)

    MShehzad
      DataGrid with id "stuGrid" displaying data fine but id "evtGrid" not showing . ModelLocator.MY_ARRAY.length shows correct value but DataGrid not showing any data.
      Any help would be appriciated ....................!

      Code is ...................................................................................
      .......................................................................................... ....
        • 1. Re: DataGrid not displaying data (Flex 1.5)
          stealthmaker
          probably the columnName property of the evtGrid DataGridColumn is pointing to an invalid column
          • 2. Re: DataGrid not displaying data (Flex 1.5)
            MShehzad Level 1
            Thanks for your reply .
            columnName property of the evtGrid DataGridColumn is pointing to an valid column. (as shown in the code)


            • 3. Re: DataGrid not displaying data (Flex 1.5)
              ntsiii Level 3
              Add a test button and check the contents of the data Provider:
              alert(ModelLocatorSGHome.MY_ARRAY.toString());

              If you just see [object Object]
              then loop over the MY_ARRAY, and trace out MY_ARRAY .title;

              Make sure your data has the structure and content you expect

              Tracy
              • 4. Re: DataGrid not displaying data (Flex 1.5)
                MShehzad Level 1
                Thanks Tracy for your reply.

                I added a test button to check the contents of the data Provider:
                mx.controls.Alert.show(ModelLocatorSGHome.MY_ARRAY.toString());

                I saw
                [object Object] , [object Object]
                then looping over the MY_ARRAY, I traced out MY_ARRAY.title;
                It showed correct values.

                I even tried to refresh DataGrid by

                mx.core.Application.application.evtGrid.dataProvider = ModelLocatorSGHome.MY_ARRAY;

                But all in vain............................................................!

                One more thing about it , when I tried

                public function onResult( event : Object ) : Void
                {
                var events : Array = new Array();
                events = event.result;
                ModelLocatorSGHome.MY_ARRAY = events;
                }

                evtGrid showed correct results.

                What I understant is when I assign service results directly there is no problem and evtGrid shows data.

                var events : Array = new Array();
                events = event.result;
                ModelLocatorSGHome.MY_ARRAY = events;

                But when I do like this

                var studentVO : Array = new Array();
                studentVO = event.result;
                ModelLocatorSGHome.STUDENTS_ARRAY = studentVO;
                var eventVO : Array = new Array();
                eventVO = studentVO[0].events;
                ModelLocatorSGHome.MY_ARRAY = eventVO ;


                evtGrid dont show data. Is above syntax correct ?
                Plzzz help.
                • 5. Re: DataGrid not displaying data (Flex 1.5)
                  ntsiii Level 3
                  studentVO is already an array of event. Why are you doing:
                  eventVO = studentVO[0].events;

                  I would not expect this to contain anything. The first element in the array, studentVO[0] IS an event, and will not contain an events object.

                  By the way, change the naming so you do not confuse the event handler argument with your "events".

                  Tracy

                  Tracy