EasyUI Forum
May 14, 2024, 08:09:42 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Suggestion: Adding icon for select and unselect all items on combobox  (Read 10679 times)
arma
Full Member
***
Posts: 110


View Profile
« 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.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!