从数据库中取出的值,循环放入map中,再把map放中list中,问怎样取出map中的key值 ,用flex语言如何实现
例如:searchResult=ArrayCollection(event.result);varcolumnsArrayCollection:Array=newArra...
例如:searchResult = ArrayCollection(event.result);
var columnsArrayCollection:Array = new Array();
var searchresult:AdvancedDataGridColumn;
for(var i:int = 0; i < 15; i++){
searchresult = new AdvancedDataGridColumn();
searchresult.headerText="A"+i;
searchresult.dataField="a"+i;
columnsArrayCollection.push(searchresult);
searchTable_ADG.groupedColumns=columnsArrayCollection;
searchTable_ADG.dataProvider = searchResult;
}我现在得到key是A1.A2.A3....但我想得到我所查询的值,怎样实现?在这里list<map>集合的值给了searchResult,(searchTable_ADG是AdvancedDataGrid 的id) 展开
var columnsArrayCollection:Array = new Array();
var searchresult:AdvancedDataGridColumn;
for(var i:int = 0; i < 15; i++){
searchresult = new AdvancedDataGridColumn();
searchresult.headerText="A"+i;
searchresult.dataField="a"+i;
columnsArrayCollection.push(searchresult);
searchTable_ADG.groupedColumns=columnsArrayCollection;
searchTable_ADG.dataProvider = searchResult;
}我现在得到key是A1.A2.A3....但我想得到我所查询的值,怎样实现?在这里list<map>集合的值给了searchResult,(searchTable_ADG是AdvancedDataGrid 的id) 展开
1个回答
展开全部
Java代码:
Public Map<String,float> getMapResult(){
Map<String,String> map =new HashMap<String,String>();
map.put(“Chinese”,98.5);
map.put(“Math”,87);
map.put(“History”,89);
return map;
}
Flex代码:
public function result(event: ResultEvent):void
{
//Java中float类型的数据对应Flex中的Number类型数据
var chinesePoint: Number = event.result["Chinese"] as Number;
var mathPoint: Number = event.result["Math"] as Number;
var historyPoint: Number = event.result["History"] as Number;
}
Public Map<String,float> getMapResult(){
Map<String,String> map =new HashMap<String,String>();
map.put(“Chinese”,98.5);
map.put(“Math”,87);
map.put(“History”,89);
return map;
}
Flex代码:
public function result(event: ResultEvent):void
{
//Java中float类型的数据对应Flex中的Number类型数据
var chinesePoint: Number = event.result["Chinese"] as Number;
var mathPoint: Number = event.result["Math"] as Number;
var historyPoint: Number = event.result["History"] as Number;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询