Browse > Home » FLEX » flex可多选的ComboBox

flex可多选的ComboBox

八月 18th, 2009 Leave a comment

今天在一Flex群上看到有童鞋需要用到可多选的ComboBox,而且内嵌CheckBox。
下午有空动了动手,做了以下的一个插件(文章最后又下载地址)。

WarmC:MyComboBox,继承自ComboBox,所以用法差不多。如果使用XML数据源的话,得自己手动进行修改。

重写了prompt的set方法,因为自带的prompt set方法会导致dropdown的MouseEvent.ROLL_OUT与MouseEvent.ROLL_OVER监听丢失,可能是因为dropdown被重新构造了的原因。 :!:

支持直接在数据源里面指定CheckBox的selected与enabled属性,这两个属性比较常用。下面的Demo里面有详细的内容。

Demo: flex可多选的ComboBox 下载地址1
flex可多选的ComboBox 下载地址2
有问题或者更好的解决办法的请不吝留言。呵呵。

转载请注明: 出自 FlexHome
原文链接:http://flex.desizen.com/multiple-selection-combobox/

Related Posts

16 条评论 »
  1. alex (2009/08/19) Reply to this comment

    多开朗的一孩子啊,纯支持! :roll:

  2. warmC (2009/08/20) Reply to this comment

    @alex: :!: 哥们怎知道我开朗?我一直都以为我隐藏的很好的啊。

  3. w3d9 (2009/10/20) Reply to this comment

    兄弟,下载不了吗 :o

  4. warmC (2009/10/20) Reply to this comment

    @w3d9: 用这个地址下载得了http://www.boxcn.net/shared/l5cyum7ne1 大米盘现在也被墙掉了,杯具!

  5. xyb (2009/12/02) Reply to this comment

    不错,不过有些细节没有处理好。
    改了下CheckBoxItemRenderer如下接口,不然dataprovider为空数组时会出错。
    override public function set data(value:Object):void{
    if ( value )
    {
    this.selected = value.selected;
    this.currData = value;
    this.label=value.label;
    }
    }
    这个接口直接用label属性作为文字属性了,例子里面MyComboBox上面将labelField设成label… ;-)

  6. warmC (2009/12/03) Reply to this comment

    :lol: 哈哈哈,谢谢指点。

  7. yxs (2010/01/15) Reply to this comment

    为什么格式是xmlList名称在下拉框里面都是空呀

  8. warmC (2010/01/15) Reply to this comment

    @yxs: 名称需要定义为节点label,可以去看Demo里面的CheckBoxItemRenderer.as这个类。

  9. yxs (2010/01/15) Reply to this comment

    还有一个问题
    private function onClickCheckBox(e:Event):void{ 这个方法里的
    listBase.selectedItems = selectedItems;这条语句赋不上值
    其中selectedItems的值是

    false
    ,

    true

    listBase.selectedItems为

    false

    但listBase.selectedItems = selectedItems;之后
    listBase.selectedItems的值还是

    false

    不知道哪里出了问题

  10. yxs (2010/01/15) Reply to this comment

    忘记说了,我的数据格式是xml的

  11. warmC (2010/01/15) Reply to this comment

    @yxs:你可以在set data(value:Object)方法里面trace一下value.enable,有时候这个值是true/false,有时候则是整个enable xml节点。未深入研究,你可以去看看这个地方!

  12. yxs (2010/01/21) Reply to this comment

    好像有些时候选多个的时候选不上,取消选中的时候会取消别的值- =

  13. xiaolong (2010/11/17) Reply to this comment

    问问
    在flex主程序module中PopUpManager出SuperPanel,SuperPanel有加载另一module,在这后一module中combobox出错
    加载module都是用的ModuleManager方法,在后面module中点击combobox组件,出现下拉菜单本身module被挡住了,无法使用

    多多请教,请回复我邮箱,谢谢!380852326@qq.com

  14. cyz (2010/11/17) Reply to this comment

    数据格式为XML怎么出不了数据,是什么原因,要怎么改。

  15. eset (2010/12/01) Reply to this comment

    初始状态下 combobox的text里面有一个值 在查询有几个被选中的时候 combobox的text的值即使不被选中的时候也会被程序认定为选中的. 这个是个问题啊

  16. tryhard (2011/11/09) Reply to this comment

    info.text+=”选中了 “+myCombox.selectedItems.length+” 个选项!\n”;

    forever length =1 ???
    why~thanks

Leave a Reply

emoticons