4 Replies Latest reply on May 5, 2009 9:33 AM by Lochinvar1

    ZendAMF - DataGrid Objects


      Driving me nuts - I cannot get an array of Objects passed from Zend AMF to display in an advancedDataGrid. The zend remote object communication works just fine, but when it gets to the datagrid, nothing displays and an Alert tels me that I have a bunch of [object Objects]. This is what my zend remote PHP function outputs:

      Array ( [0] => GameObj Object ( [Game] => ddd vs. aaa - 2009-04-18 [Scorer] => Bob [Component] => Team Scores ) [1] => GameObj Object ( [Game] => ddd vs. aaa - 2009-04-18 [Scorer] => Bob [Component] => Possession ) )... etc


      On the Flex side, I capture this in an array, and then put it into an arrayCollection called dataArray - which is the dataProvider for my dataGrid (with a dataGridcolumn for each of Game, Scorer, Component).


      Nothing displays in the dataGrid, but Alert.show(String(dataArray), "Data"); gives me

      [object Object],[object Object],[object Object] etc.


      Thanks in advance for any suggestions - Lochinvar

        • 1. Re: ZendAMF - DataGrid Objects

          try letting the DG render it without the dg columns first.. see if your field titles are correct. it may also be that the objects are nested deeper than you think and the dg is confused.

          1 person found this helpful
          • 2. Re: ZendAMF - DataGrid Objects
            Lochinvar1 Level 1

            Thanks ethr - seems you are right because without columns specified, I get a column for each [object Object] with the array index number as the heading - My question then is - How do I get the DG to drill down a level (or 2)?  Becasue lifting a level in the PHP creates the problem of the object being over-written by each iteration over the rows (from Db query).

            • 3. Re: ZendAMF - DataGrid Objects
              ethr Level 1

              It sounds like its not being mapped into the arraycollection properly. You have an additional layer of array in there. Can you look at the arraycollection in a debugger? You may have to dig deeper into the resultset to get it mapped properly.

              • 4. Re: ZendAMF - DataGrid Objects
                Lochinvar1 Level 1

                Thanks ethr - sorted
                Debug mode did help me figure that:








                rawArray:Array = new Array(event.result);

                dataArray = new ArrayCollection(rawArray);


                behaves differently in terms of how deep the object is than


                dataArray =

                new ArrayCollection(event.result as Array)  //(this one has fewer levels)


                Which suggests to me that "new Array" creates an array wrapper while "as Array" casts the existing result as an Array - even though the IDE sugggests they are equivalent... anyway - fixed.... moving on to find the next problem... advancedDataGrid grouping ...