2 Replies Latest reply on Nov 13, 2008 1:21 AM by gallaharsha

    Java Hashtable to DataGrid, quick question

    AleksandarBalalovski Level 1
      my remote object returns Hashtable in which there is data to show in DataGrid. What is the most simple way to represent that data in the DataGrid?
        • 1. Re: Java Hashtable to DataGrid, quick question
          Karl_Sigiscar_1971 Level 3

          java.util.HashMap is deserialized as Object in ActionScript 3.

          When you get the result from your call (Cairngorm example):

          public function onResult( event : * = null ) : void
          var result:Object = (event as ResultEvent).result as Object;

          Store the result in your model. For example in this.model.sales.lastYearSales;

          Then use it as the dataProvider of your datagrid.

          <mx:Datagrid dataprovider="{this.model.sales.lastYearSales}" />
          • 2. Re: Java Hashtable to DataGrid, quick question
            I had a similar issue recently wherein I was receiving HashMap as a HTTP response taken as an object in the front end. I did lot of research for a day and could not solve it either. Finally i solved the issue using some logic, though it may seem weird to some. I observed the resulting object form using debugging then wrote some funtions which would do the following:
            1) Convert the object to string ( this is possible by use of some simple method)
            2)then split the resultant string and create a new Array collection as per choice.

            This worked out well and now I could get data populated into my DataGrid in this way..
            Hope this helps..
            Incase you dont find any solution you could try this.
            Any further help regarding this idea contact me.