我们一直面临在 IE 的下拉/组合框中显示状态列表的问题。我们确实有 1 个 REST Web 服务,它从 Constant.java 文件中读取状态字符串值列表并返回到 Flex命令; 这又是组合框的数据提供者。弹性代码如下;在 callback() 中,我们只是将响应列表中的元素推送到对象中。
private function loadStates():void
{
model.stateCode=new Array();
model.statesArr=new Array();
var obj:Object=new Object();
var objOne:Object=new Object();
obj={label: "Select", tip: "Select the state"};
objOne={label: "Select State", data: "Select State"};
model.stateCode.push(obj);
model.statesArr.push(objOne);
for (var i:int=0; i < model.stateDetail.length; i++)
{
obj={"label": model.stateDetail[i].stateCode, "tip":
model.stateDetail[i].stateDecsription};
objOne={"label": model.stateDetail[i].stateCode + '-' +
model.stateDetail[i].stateDecsription, "data":
model.stateDetail[i].stateCode};
model.stateCode.push(obj);
model.statesArr.push(objOne);
}
}