matt,Manish Jethani
thank you
the detail what to do is below:
1.the Java method:
public ArrayList findAllUsers(){
ArrayList list = new ArrayList();
try{
PreparedStatement pstmt = getDB
().getConnection().prepareStatement(QUERY_ALL);
ResultSet rs = pstmt.executeQuery();
HashMap map = new HashMap();
while(rs.next()){
UserVO user = new UserVO();
map.put(new String("crm"),new
Integer(rs.getInt("crm")));
map.put(new String("cdms"),new Integer
(rs.getInt("cdms")));
map.put(new String("farnet"),new Integer
(rs.getInt("farnet")));
map.put(new String("par"),new Integer
(rs.getInt("par")));
map.put(new String("onyx"),new Integer
(rs.getInt("onyx")));
map.put(new String("promo"),new Integer
(rs.getInt("promo")));
user.setNetworkId(rs.getString("network_id"));
user.setFirstName(rs.getString("firstname"));
user.setLastName(rs.getString("lastname"));
user.setLoggedOn(rs.getString("loggedOn"));
user.setActive(rs.getString("active"));
user.setAccessMap(map);
list.add(user);
}
}
catch(Exception e){
}
finally{
db.close();
}
return list;
}
2.the related flex page:
the object userList is return from the above method
and I want to display the Object
<mx:DataGrid id="dgContact" change="selectContact
(dgContact.selectedIndex)" dataProvider="{userList}" width="100%"
height="100%" toolTip="Contact List">
<mx:columns>
<mx:Array>
<mx:DataGridColumn columnName="networkId" headerText="Network
ID" marginLeft="4" width="50"/>
<mx:DataGridColumn columnName="firstName"
headerText="First Name" marginLeft="4" width="60"/>
<mx:DataGridColumn columnName="lastName"
headerText="Last Name" marginLeft="4" width="60"/>
<mx:DataGridColumn columnName="active"
headerText="Active" marginLeft="5" width="50"/>
<mx:DataGridColumn columnName="loggedOn"
headerText="Status" marginLeft="5" width="50"/>
<mx:DataGridColumn columnName="??????" headerText="crm"
marginLeft="5" width="70"/>
</mx:Array>
</mx:columns>
</mx:DataGrid>
how to write the ??? and the related actionscript
after got the userList and make the attribute
hashmap to Array? is it ?
--- In [email protected], Matt Chotin <[EMAIL PROTECTED]> wrote:
> I'm not sure what you're trying to do. If you have the accessMap
you can
> index into it using names (accessMap['foo']). Are you trying to
make the
> hashmap the dataProvider of the DataGrid? That's not going to
work, you
> need a linear list for that to happen (which you could create
pretty easily
> by iterating over the hash map and simply filling an array with
each time).
>
>
>
> Matt
>
> _____
>
> From: loveewind [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, April 13, 2005 9:37 AM
> To: [email protected]
> Subject: [flexcoders] how to display the HashMap data in flex
<mx:DataGrid>?
>
>
>
>
> my java object below:
> public class UserVO {
> private HashMap accessMap = null;
> private String active = null;
> private String firstName = null;
> private String lastName = null;
> private String loggedOn = null;
>
> private String networkId = null;
>
>
> /**
> * @return
> */
> public HashMap getAccessMap() {
> return accessMap;
> }
> ..
> }
>
> my actionscript object below:
>
> class com.zdus.crm.user.UserVO{
> var firstName:String;
> var lastName:String;
> var networkId:String;
> var loggedOn:String;
> var active:String;
> var accessMap:Object;
> static var registered=Object.registerClass
> ("com.zdus.crm.user.UserVO",com.zdus.crm.user.UserVO);
> }
>
> I have got the hashmap on flex age from remoteobject certainly
>
> i know treat the hashmap as a index array,but i can not do it
>
> thank you! wait for your help online
>
>
>
>
>
>
> _____
>
> Yahoo! Groups Links
>
> * To visit your group on the web, go to:
> http://groups.yahoo.com/group/flexcoders/
> <http://groups.yahoo.com/group/flexcoders/>
>
> * To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
>
> * Your use of Yahoo! Groups is subject to the Yahoo!
> <http://docs.yahoo.com/info/terms/> Terms of Service.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/