I have a cairngorm 2 application with a custom view that represents 
an "order_item" with various properties.  My ModelLocator uses an 
array of value objects (of type order_item_vo) and then the 
application has a series of "order_item_view" objects in the UI.

Everything works very well, *except* for one problem that I've been 
struggling with for a while now.  The "order_item_view" component 
has 2 mx:ComboBox controls (in addition to various TextInput and 
other controls).  One of these ComboBox controls has a definition 
like this:

<mx:ComboBox width="200" height="20" id="finish" 
dataProvider="{model.order_entry_item_array.getItemAt
(item_array_offset).finish_array}" 
selectedIndex="{model.order_entry_item_array.getItemAt
(item_array_offset).finish_selected_index}" change="validate_finish
()" ></mx:ComboBox>


The dataProvider is working great (pulls from an XML web service) 
and everything is fine *until* you select a value in the ComboBox.  
At first, everything looks fine, but then if you make a change to 
any other control (change text in another TextInput, for example) 
then the ComboBox reverts back to a selectedIndex = 0 (it re-selects 
the first item in the box).

Here is my "validate_finish()" function:

private function validate_finish() : void
{
        model.order_entry_item_array.getItemAt
(item_array_offset).finish_selected_index = finish.selectedIndex;
        //finish.selectedIndex = 
model.order_entry_item_array.getItemAt
(item_array_offset).finish_selected_index;
        //Alert.show("3: " + finish.selectedIndex.toString() + " = " 
+ model.order_entry_item_array.getItemAt
(item_array_offset).finish_selected_index);
}


I left the commented lines in there because I've tried a few things 
to figure out what is going on.  It seems that any time I make *any* 
change to the model, the finish.SelectedIndex goes back to 0.  This 
happens regardless of whether or not the selectedIndex property of 
the ComboBox is set to the model...finish_selected_index value, 
something that I found to be *very* strange since at that point the 
control was not tied to the model at all.

I can't figure out how to keep the finish.selectedIndex 
from "resetting" when the model changes, and it's driving my crazy!

Any insight?

Thanks in advance!











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