ComboBox Behavior: Flash Bug or Programming work-around?

477
2
06-01-2010 10:22 AM
JamesFaron
Occasional Contributor
I adopted Robert's Search Widget with drop-down as in this thread:http://forums.esri.com/Thread.asp?c=158&f=2421&t=289747&mc=6#msgid901640. I then updated the Search Widget with floating Datagrid, and I thought that all was good, until I discovered that the child box (id DropDownSel) exhibits strange behavior as follows, and as demonstated graphically in the attached pdf.

If I do not actually select an item in the 'child' box (id DropDownSel), and then I navigate the Parent (combo Box id cboLayerText) to a different layer source , only the first item will appear as expected in the 'child' box, but when you select the dropdown arrow, it populates with items from the prior layer source, i.e. the prior layer list, which is defined in the SearchXML as <dropdown>.

What is stranger still, if I click on one of those values from the prior list, the actual value that loads is from the current 'parent' layer list, and the list in the combobox is refreshed. I have tried various code fixes involving refresh, and even extended the combo box following advise from a blog post, but I cannot get this to work correctly. Another way of putting this is that the user must make a selection of an item in the child list other than the first item, or if he/she navigates the Search layer parent list to another layer, the values in the child box will not load as expected, as described above. The pdf demonstrates this with screen shots.

I know that combo box controls are the source of frequent issues with Flash, but I hope that someone can suggest a fix.

Thanks,
Jim Faron
Austin Independent School District
Tags (2)
0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus
James,

   This seems to be a common Flex SDK issue.

Here is the workaround.

private function searchLayerChangedText():void
   {
    var i:Number = cboLayerText.selectedIndex;
    txtLabelText.text = configSearchText.textlabel;
    if (configSearchText.dropdown != "")
    {
     var ddStr:String = configSearchText.dropdown;
     dropdownArr = [];
     dropdownArr = ddStr.split(",");
     ddVis = true;
     DropDownSel.dataProvider = new ArrayCollection(dropdownArr);
     DropDownSel.dropdown.dataProvider = new ArrayCollection(dropdownArr);
     txtSearch.visible = false;
     txtSearch.includeInLayout = false;
    } else {
     ddVis = false;
     DropDownSel.dataProvider = [];
     txtSearch.visible = true;
     txtSearch.includeInLayout = true;
    }
   }


Notice you have to set the dropdown.dataProvider as well as the normal dataProvider of the combobox.
0 Kudos
JamesFaron
Occasional Contributor
Robert,

You bailed me out once again. I chased this one up and down the Internet, not thinking or finding about creating an ArrayCollection  or adding the extra data provider. Hopefully this solution will find its way into the blogoshpere for other lost souls.

Thanks again,

Jim Faron
Austin Independent School District
0 Kudos