EasyUI Forum

General Category => General Discussion => Topic started by: arma on August 07, 2014, 11:44:56 PM



Title: Suggestion: Adding icon for select and unselect all items on combobox
Post by: arma on August 07, 2014, 11:44:56 PM
Hi,

I guess it would be better if combobox has a property to show optional icon with method next to arrow icon on combobox with multiple property to select and unselect all items. If combo has a lot items, it would be very handy rather than tick one by one.

Do you guys have better option for this?

Thanks.


Title: Re: Suggestion: Adding icon for select and unselect all items on combobox
Post by: stworthy on August 08, 2014, 04:07:02 AM
The 'icons' property can be used to append additional icon buttons to the combobox. Try the code below:
Code:
<input class="easyui-combobox" 
    name="language"
    data-options="
        url:'combobox_data1.json',
        method:'get',
        valueField:'id',
        textField:'text',
        multiple:true,
        panelHeight:'auto',
        icons:[{
          iconCls:'icon-selectall',
          handler:function(e){
            var c = $(e.data.target);
            var opts = c.combobox('options');
            $.map(c.combobox('getData'), function(row){
              c.combobox('select', row[opts.valueField])
            })
          }
        },{
          iconCls:'icon-unselectall',
          handler:function(e){
            var c = $(e.data.target);
            var opts = c.combobox('options');
            $.map(c.combobox('getData'), function(row){
              c.combobox('unselect', row[opts.valueField])
            })
          }
        }]
    ">

The extra icons example is available from http://www.jeasyui.com/demo/main/index.php?plugin=ComboBox&theme=default&dir=ltr&pitem=Extra%20Icons