I haven't worked with anything like this specific scenario, but I assume you should be enacting changes using an event listener on the "change" event -- either listening for a change in the Combobox or listening for change event in DropDownList (not sure from the way you worded your post, but I'm assuming you will want to listen for change event on Combobox, which will be triggered when text content within the box changes), and then put your dynamic sizing in the change event listener/handler.
Its not that complicted i just wanted to change the dropdown width of the combobox when ever there is a change in dataprovider. But its only effecting after we select the another item in the combobox not instantaneously.
What are you using as a data provider? It sounds like you have it working enough that it must be a bindable data you are using, but I know some data types are better at triggering events/changes than others -- ArrayCollection works well for this, for instance.
a) Make sure the data source is bindable
b) It's preferably a type that allows bindable access to its properties (like ArrayCollection)
c) Try adding event listeners for the "change" event, starting at the top (display element) level and then if that doesn't work, try working down from there using change events on the subelements/containers
I am using ArrayCollection as dataprovider and its declared as bindable. The data in the combobox is updating but the dropdownwidth which i am calculating and assigning is not updating instantaneously its only updating after i selected any other item in the combobox.
Okay, you can set a change event listener in the ComboBox like:
However, there have been some changes from the old mx:ComboBox to the new Spark version s:ComboBox
If you were using mx:ComboBox, I think you could use the dataChange event:
You would need to dataChange for that instead of the change event because "change" is dispatched when the ComboBox contents changes as a result of user interaction, when the selectedIndex or selectedItem property changes, and, if the ComboBox control is editable, each time a keystroke is entered in the box.
However, this is not exactly the same in the spark version; I don't think there is a dataChange event, for one thing.
I don't think checking events on the s:ComboBox will help in this case (unless you click on another item, as you mentioned); however, you should be able to use events triggered by changes to the underlying data provider. I'm not sure about all of the events associated with ArrayCollection, but I think you should be able to do:
yourDataCollection.addEventListener(CollectionEvent.COLLECTION_CHANGE, collectionChangeHandler );
and in the collectionChangeHandler you can merely update the combobox dropdownwidth to match the maxwidth of the ArrayCollection items...
[If I'm wrong about the event type/name, you might need to change it -- but the same basic logic holds: you want to set the dropdownwidth box when using an event listener on the data provider, not the visual element/container itself]
Yeah i tried all the things exactly what you told before posting but still it isnt updating. May be the problem resides with framework 3.5. I am not sure but may be it might be the issue.
Is there any solution for this problem.
Thanks and regards,