Yes thanks.
Actually I'm creating some "help" method to achieve this task.
But in the documentation says if the dataprovider of the combobox has
a data property the selectedIndex will search on it for the matching
value.
I notice that with the following data.
/**/
dataProvider for the combobox from Database-table:
This SQL produce this output.
"Select id as data, cat_name as label from users_categories";
//with this SQL I don't need to specify labelField = "cat_name" in the
combo;
//After asign to my_combobox.dataProvider = cat_result;
The dataprovider becomes in..:

index | data | label
----------------------- 
    0 | 1    | "cat one"
    1 | 2    | "cat two"
    2 | 3    | "cat three"
    3 | 45   | "cat 45"
    4 | 95   | "cat new"

When I put my_combo.selectedIndex = 1;
the combo select the dataprovider[1] item, "cat two".

Whe I put my_combo.selectedIndex = 45; //they search in data prop.
They display correctly the dataprovider[3] item "cat 45".

This is a bug? 
Thanks 





--- In flexcoders@yahoogroups.com, "Sam Shrefler" <[EMAIL PROTECTED]> wrote:
>
> Luchyx:
> 
> The way I've gotten this to work is as follows
> 
> selectedIndex="{Utils.ComboBoxSelect(AllPossibleValuesInArrayCollection,
> 'data', selectedValueFromServer)}"
> 
> public class Utils
>  {
>   public static function ComboBoxSelect(ac:ArrayCollection,
field:String,
> value:Number):Number
>   {
>    for (var i:Number=0; i<ac.length; i++)
>    {
>     if(ac[i][field] == value)
>      return i;
>    }
>    return 0;
>   }
>  }
> 
> Hope that helps
> 
> Sam
> 
> 
> On 10/9/06, luchi_bustos <[EMAIL PROTECTED]> wrote:
> >
> >   Hello list!.
> > I'm having troubles with a Combobox and selectedIndex.
> > I'm populating the combobox with an array of categories, that was
> > returned by AMFPHP service call with this SQL.
> > /*code SQL
> > "select id_cat AS data, cat_name AS label FROM users_types ORDER
> > id_cat ASC";
> > */
> > This return an array of all availables categories and populate the
> > combobox.
> > After that I retrieve an especific "user" with and especific
> > user_level_index value that match the real index in the users_types
> > database table.
> > I setting the selectedIndex in the Combobox via.
> > /*code
> > userslevelCat_cb.selectedIndex = userfromserver.user_type_index;
> > */
> > The problem is that the selected index is different than the real
> > index field in the database.
> > So if I sort te query in a diferent way
> > the selectedIndex is diferent, and didn't reflect the real
category name.
> >
> > I'm reading some paper's that say if I use an array of {data:#,
> > label:"cat uno"}, the combo box will try to find the corresponding
> > value in the "data" property field when I use selectedIndex.
> >
> > Does anybody here know the problem,has possible solution, or
> > recomendation?
> >
> > Thanks in advance.
> >
> > Luchyx
> >
> > 
> >
>






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> 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/
 



Reply via email to