Hi All,
I am able to resolve the problem by using the type Object rather
than Array and now i use the following to get the data from the Object
instance..
[CODE]
if(obj!=null){
for (var key:String in obj) {
trace(" Key ="+key+" Value ="+obj[key]);
}
}
[/CODE]
How ever in my view i am generating the Columns of a DataGrid at
runtime and then assigning the dataProvider. Now the DataGrid is not
showing the values even though they are available in the Object i am
setting for the dataProvider..!!
Code to add the columns to the DataGird..
[CODE]
public function addColumns(propertyCollection:ArrayCollection):void{
for(var j:int=0;j<propertyCollection.length;j++){
var dgc:DataGridColumn = new
DataGridColumn("propertyHolderMap["+propertyNameTmp+"]");
trace("Column DataField ="+dgc.dataField);
dgc.headerText= propertyNameTmp;
gridCols.push(dgc);
}
myDataGrid.columns = gridCols;
}
....
<mx:DataGrid id="collectionBrowserItemView" width="100%" height="100%">
<mx:columns>
<mx:DataGridColumn headerText="Display Name " dataField="nodeLabel"
editable="false" >
<mx:itemRenderer>
<mx:Component>
<mx:HBox>
<mx:Image source="/apps/kwrite.png"
click="outerDocument.annotate(1)" width="15" height="15"/>
<mx:Label text="{data.nodeLabel}" />
</mx:HBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
[/CODE]
My DataGird will always have a Column (which is column 0) and i add
columns depending on a User Action..
I Checked the keys passed from the Server and the datafield set to the
columns added at runtime and they match exactly..
Regards
Mars
--- In [email protected], "sk_acura" <[EMAIL PROTECTED]> wrote:
>
> Hi All,
>
> I am finding it hard to Map java.util.HashMap to an ActionScript
> Object using Blaze DS.
>
> In the Adobe documentation it is given that Maps will be mapped to
> Associative array...
>
> How ever when i try to type cast the Object it is becoming null!!
>
> Here my Server side Object
>
> [CODE]
> package com.myapp.valueObject.CollectionBrowserNode;
>
> public class CollectionBrowserNode extends Node{
>
> private String dateCreated;
>
> private String description;
>
> private HashMap<String,String> propertyHolderMap;
>
> // Setter and Getters for the above follows.
> }
>
> [/CODE]
>
> And my correpsponding Action Script Class is
>
> [CODE]
> [Bindable]
> [RemoteClass(alias="com.myapp.valueObject.CollectionBrowserNode")]
> public class CollectionBrowserNode extends Node
> {
> public function CollectionBrowserNode()
> {
> super();
> }
>
> public var dateCreated:String;
> public var description:String;
> public var propertyHolderMap:Array;
>
> }
> [/CODE]
>
> I tried converting the Datatype to Object in the ActionScript Class
> and it gets the Data but i am unable to read any thing form it..
>
> When i declared the type as Object and try to use the describeType
> it returns the following..
>
> [OUTPUT]
> Object Type [XML String]=<type name="Object" isDynamic="true"
> isFinal="false" isStatic="false">
> <method name="hasOwnProperty" declaredBy="Object"
> returnType="Boolean" uri="http://adobe.com/AS3/2006/builtin">
> <parameter index="1" type="*" optional="true"/>
> </method>
> <method name="isPrototypeOf" declaredBy="Object"
> returnType="Boolean" uri="http://adobe.com/AS3/2006/builtin">
> <parameter index="1" type="*" optional="true"/>
> </method>
> <method name="propertyIsEnumerable" declaredBy="Object"
> returnType="Boolean" uri="http://adobe.com/AS3/2006/builtin">
> <parameter index="1" type="*" optional="true"/>
> </method>
> </type>
> [/OUTPUT]
>
> And when try to type cast using
>
> var testArray:Array = obj as Array;
> trace("testArray ="+testArray);
>
> It prints the testArray as null !!!!
>
> Not sure what's going wrong. Pls let me know ..
>
> Thanks
> Mars..
>