Thursday, April 15, 2010

Flex Combobox

xmlSalons = XML(this.loadSalons.lastResult);
var xSalons:XMLList = xmlSalons.salon;

// add default for nothing
salons.push({data:"-1",label:"I will select a salon later."});

for each (var xSalon:XML in xSalons)
{
salons.push({data:xSalon.salonId,label:xSalon.name});
// for future usage to push salon object (for management) i.e. create/delete
//salons.push(new Salon(xSalon.salonId, xSalon.userId, xSalon.type, xSalon.name, xSalon.description));
}

ddlSalons.dataProvider = salons;
ddlSalons.labelField = "label";
ddlSalons.data = "data";
ddlSalons.selectedIndex = 0;

var obj:Object = ddlSalons.selectedItem;
obj["salon"] = obj["data"];

No comments: