I’d to use my database field value to select a value on my <s:DropDownList
I try to do
<s:DropDownList dataProvider="{DP_PAT_CIVIL}" selectedItem="@{objectUser.usrQualParent}"/>
But no selection appear, nothing appear on prompt.
objectUser.usrQualParent represent a value with is present in the dataprovider DP_PAT_CIVIL.
For exemple, dataprovider is:
[Bindable]
private var DP_PAT_CIVIL:ArrayCollection = new ArrayCollection (
[{label:"Monsieur" , data:"0"},
{label:"Madame", data:"1"},
{label:"Mademoiselle", data:"2"},
{label:"Le Jeune", data:"3"}]
);
And objectUser.usrQualParent value is "Monsieur".
Thanks for helping
Selected item should point to exact item from data provider. For simple types of which data provider can consist (like
String,Booleanorint) it can be equal that value. For complex objects it should be exactly the same value (pointer to the same memory’s unit).So, in your case,
"Monsieur"isn’t an item of data provider which consists ofObjects but notStrings. But the following isn’t the way too:because of it is newly created but not the same object.
I recommend you create some function for searching exactly the same value from the existing data provider using your string as a key:
Now your list: