actionscript 3 - Flex 4 remove selected item from spark DropDownList -


my stakeholder has request remove selected item dropdownlist control(s) in application. example drop down [item1, item2, item3, item4] if item2 selected items in drop down [item1, item3, item4]

any thoughts on if possible , if how implement appreciated.

thanks in advance.

using flash builder 4 flex 4.0 sdk

as long dropdown list uses arraycollection data provider, can specify filter function remove current selected entry:

<s:application xmlns:fx="http://ns.adobe.com/mxml/2009"                 xmlns:s="library://ns.adobe.com/flex/spark"                 xmlns:mx="library://ns.adobe.com/flex/mx"                creationcomplete="oncreationcomplete()">     <fx:script>         <![cdata[              [bindable] private var _yourac:arraycollection = new arraycollection(['item 1', 'item 2', 'item 3']);              private function oncreationcomplete():void             {                 _yourac.filterfunction = filter;             }              private function filter(item:object):boolean             {                 return item != list.selecteditem;             }          ]]>     </fx:script>     <s:dropdownlist id="list" dataprovider="{this._yourac}" change="this._yourac.refresh();" /> </s:application> 

i think should filter out selected item :)


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -