Flex beta 2 - ComboBox not workingteocomi Oct 24, 2009 12:05 PM
it seems like ComboBoxes are not working with sdk 4.0.0.10485; while they were with 4.0.0.7219
i simply click and nothing happens..
code is this:
<mx:ComboBox>
<mx:ArrayCollection>
<fx:String>AK</fx:String>
<fx:String>AL</fx:String>
<fx:String>AR</fx:String>
</mx:ArrayCollection>
</mx:ComboBox>
but also using other kind of dataProviders it's the same..
am i mistaken?
Thanks!
1. Re: Flex beta 2 - ComboBox not workingteocomi Oct 24, 2009 12:08 PM (in response to teocomi)
the dropdownlist instead works proprely..
2. Re: Flex beta 2 - ComboBox not workingkingquattro Oct 24, 2009 1:45 PM (in response to teocomi)
I second this issue. I have a comboBox that whose data is fetched from DB based on another combo box selection. I get right data fetched, and then using combobox.dataprovider = Arraycollection to update the values, the assignment is done without any errors, but the change is not displayed on the web. Except when I click on one of the selection in the combo box, only then I see the data changed, other wise the data see is the old one.
Jay
3. Re: Flex beta 2 - ComboBox not workingDavid_F57 Oct 24, 2009 9:49 PM (in response to teocomi)
Hi,
Maybe i'm not understanding the problem, but if I populate a combobox with an initial index set to 0 the box displays correctly if I change the value associated grids or labels change correctly.
David
this is a basic example
I forgot to attach the code to the example so here it is
<.collections.ArrayCollection;
[Bindable] private var myData'}]);
]]>
</fx:Script>
<mx:ComboBox
<mx:DataGrid
<mx:columns>
<mx:DataGridColumn
<mx:DataGridColumn
<mx:DataGridColumn
</mx:columns>
</mx:DataGrid>
<s:Label
<s:Label
</s:Application>
4. Re: Flex beta 2 - ComboBox not workingkingquattro Oct 24, 2009 10:10 PM (in response to David_F57)
umm, well I think I haven't done a good job of explaining the situation, sorry, let me try again.
I have a form view, initially combo box A is populated, and combo box B is empty. When user selects something in A, a close event is dispatched, and based on the A.selectedItem.data, a cfc fetch's data from db and an ArrayCollection is returned which is set as B.dataprovider and all data is seen as expected in B
So far as expected.
Now if user selects another value in A, a cfc fetch's and B.dataprovider is set again. Here the data is not updated, I still see results from previous selection of A. But if I select any value in B, then and only then does the data for B is show correctly i.e result from second selection of A. I am using B.validateNow() every time b.dataprovider is executed.
Hope this helps
Jay
5. Re: Flex beta 2 - ComboBox not workingDavid_F57 Oct 24, 2009 10:44 PM (in response to kingquattro)
Ok, so the initial post seemed to have an issue with the combobox not selecting which seems more a coding issue as I can't replicate an issue with a combobox ignoring selection. in the case of 'a' populating 'b' and 'b' populating a form the only thing I can think of is that unless the selected index on b is reset after the data is changed b's form will remain unchanged and b itself maybe sitting on a selected index of -1 due to the list being invalidated during the data change process.
Just a thought , if I have a bit of time I will setup something (php as I don't use coldfusion) and see if I get a similar issue.
David
6. Re: Flex beta 2 - ComboBox not workingPeter deHaan Oct 25, 2009 12:15 AM (in response to kingquattro)
@kingquattro,
Can you post a bit of code? Are you listening for a close event, or a change event on the ComboBox?
Peter
7. Re: Flex beta 2 - ComboBox not workingkingquattro Oct 25, 2009 5:52 AM (in response to Peter deHaan)
sure I should have done that in earlier sorry.
here it is the snippet
var _tempLibId:Number = -1;
protected function getlibReq(v:Number):void{
libraryRequest.token=Library.getLibraryObject(env_item.selectedItem.data);
_tempLibId=v;
}
protected function libraryResponse(event:ResultEvent):void{
var ac:ArrayCollection = event.result as ArrayCollection;
lib_item.dataProvider = ac;
lib_item.selectedIndex=0;
lib_item.validateNow();
for (var i:int=0;i<ac.length; i++)
if (ac.getItemAt(i).data == _tempLibId)
lib_item.selectedIndex=i;
}
.....
<mx:FormItem
<mx:ComboBox
</mx:FormItem>
<mx:FormItem
<mx:ComboBox
</mx:FormItem>
In each of the combo box I always have my first value as "Select One" with value of -1.
You can see a working copy of this issue at;
If you select "Environment" library combo box will change which is initially empty. Next you change "Environment" again and you will see the problem arise.
Thank you
Jay
8. Re: Flex beta 2 - ComboBox not workingDavid_F57 Oct 25, 2009 9:13 AM (in response to kingquattro)
Ok, it looks like you pass -1 to your data request routine then use -1 to find a position in the second combobox this would mean you would always get the same result, which if i read the logic right woud be a fail every time As no matter what you select you search for -1 which I am assuming is not data but an index number.
David.
9. Re: Flex beta 2 - ComboBox not workingPeter deHaan Oct 25, 2009 9:27 AM (in response to David_F57)
Also, I would use the change event and not the close event.
(a) It is possible to open/close a ComboBox and not change the selected value (so you'd be doing a whole CFC call for nothing).
(b) It is possible to change the selected ComboBox value without opening the dropdown (pressing up/down when the ComboBox button has focus), and in this case you'd never call your CFC to change the related value.
Also, if you could send all the related data as XML, you could try something like this which wouldn't require you to call CFCs whenever the ComboBox values are changed;
Peter
10. Re: Flex beta 2 - ComboBox not workingDavid_F57 Oct 25, 2009 9:36 AM (in response to Peter deHaan)
definitely pay a visit to Peters blog site and spend a bit of time going through his examples its the best FB4 reference link you could add to your browser.
Also I would be inclined to attach your dataprovider in the combobox declaration and not redeclare the array or reattach it each time you do a request. If you feel the urge you can always clear the array before repopulating it with new data(although you don't need to).
11. Re: Flex beta 2 - ComboBox not workingkingquattro Oct 25, 2009 10:28 AM (in response to David_F57)
OK so here is something really strange.
I tried the simplest case
<fx:Script>
....
[Bindable] private var _libs:ArrayCollection = new ArrayCollection();
protected function getlibReq():void{
libraryRequest.token=Library.getLibraryObject(env_item.selectedItem.data);
}
protected function libraryResponse(event:ResultEvent):void{
_libs = event.result as ArrayCollection;
}
....
</fx:Script>
<mx:FormItem
<mx:ComboBox
</mx:FormItem>
<mx:FormItem
<mx:ComboBox
</mx:FormItem>
Still If I select a environment, and then WITHOUT any selection (I just view the values and close it) in library combo box I select another environment, and then I open the combo box again, the value are from previous environment selection, but If I select one value in library combo box, values are changed.
BUT if I select an environment, and then SELECT a value in library combo box which is a value other than the first one. Then go back to environment
combo box and select a new value, all values in library combo box change, and are displayed properly.
This is strange. Its seem that the library combo box does not get rendered with proper data unless a change even occurs in that box, but in my code I am never listening for or dispatch a change event for library combo box only for environment combo box.
here is what my sample data for env and lib combo box look like
env array collection:
arr[0].label="Select One"
data="-1"
arr[1].label = "Water"
data = "1"
arr[2].label = "Soil"
data="2"
lib array collection:
arr[0].label="Select One"
data="-1"
arr[1].label="CBAY"
data="1"
arr[2].label="MBS"
data="2"
...
12. Re: Flex beta 2 - ComboBox not workingDavid_F57 Oct 25, 2009 12:04 PM (in response to kingquattro)
ok, round 10,
this last round triggered my memory about a caching issue in lists that was resolved about 2 months ago its starting to smell a little like that so I need to do a search in jira and see if it is the same thing. In the mean time this is using the spark component, see if it gets closer to what you are chasing.
(it only works for item 1 and item 2 - i'm lazy )
David.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx=""
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:
<fx:Script>
<![CDATA[
import spark.events.IndexChangeEvent;
import mx.collections.ArrayCollection;
[Bindable] private var myStates'}]);
[Bindable] private var myACT:ArrayCollection= new ArrayCollection([
{Key:1,state:'ACT',name:'Kingston'},
{Key:2,state:'ACT',name:'Manuka'},
{Key:3,state:'ACT',name:'Narrabundah'},
{Key:4,state:'ACT',name:'RedHill'}]);
[Bindable] private var myNSW:ArrayCollection= new ArrayCollection([
{Key:1,state:'NSW',name:'Cronulla'},
{Key:2,state:'NSW',name:'Gymea'},
{Key:3,state:'NSW',name:'Miranda'},
{Key:4,state:'NSW',name:'Yowie Bay'}]);
[Bindable] private var myInfo:ArrayCollection= new ArrayCollection();
private function appInit(): void
{
myInfo=myACT;
}
protected function cb1_changeHandler(event:IndexChangeEvent):void
{
switch(cb1.selectedIndex)
{
case 0: myInfo=myACT;
break;
case 1: myInfo=myNSW;
break;
}
cb2.selectedIndex=-1;
}
]]>
</fx:Script>
<s:DropDownList</s:DropDownList>
<s:DropDownList</s:DropDownList>
</s:Application>
13. Re: Flex beta 2 - ComboBox not workingPeter deHaan Oct 25, 2009 5:04 PM (in response to kingquattro)
One other thing, when resetting the data provider, try setting the lib_item data provider's index to -1 as well and see if that makes a difference:
protected function libraryResponse(event:ResultEvent):void{
_libs = event.result as ArrayCollection;
lib_item.selectedIndex = -1;
}
Peter
14. Re: Flex beta 2 - ComboBox not workingkingquattro Oct 26, 2009 8:21 AM (in response to Peter deHaan)
Hey guys,
Spark DropDownList works just fine. But the mx:ComboBox does not work still issue with caching, I have even tried to set the selectedIndex to -1, even tried to make multiple selectedIndex statements in the hopes of simulation a change event, but that does not help either. any one know how to make a spark drop down list look just like the halo combo box? I did few search and didn't find any thing about it.
Thanks
Jay
15. Re: Flex beta 2 - ComboBox not workingDavid_F57 Oct 26, 2009 8:26 AM (in response to kingquattro)
Hi,
You can skin the component, if you right click on the spark component there is an option to copy the default skin. That will give you a new skinclass which you can then modify so that it looks more like the halo control.
David.
16. Re: Flex beta 2 - ComboBox not workingPeter deHaan Oct 26, 2009 10:41 AM (in response to kingquattro)
@kingquattro,
I'm not sure why it would work with Spark DropDownList but not the Spark/Halo ComboBox control.
Can you please file a bug at and include your source code and somebody at Adobe can investigate further.
Thanks,
Peter
17. Re: Flex beta 2 - ComboBox not workingPeter deHaan Oct 26, 2009 5:02 PM (in response to Peter deHaan)
Scratch that. Alex Harui sent me a simple test case showing the issue and I've filed it at
Please feel free to add your comments (or vote/subscribe) to the bug.
Thanks,
Peter