EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: JohnWang on December 05, 2014, 08:22:30 PM



Title: How to add tooltip for the icon of a combobox
Post by: JohnWang on December 05, 2014, 08:22:30 PM
Dear admins,
How to add tooltip for the icon of a combobox? I want to add "selectAll" and "unSelectAll" as tooltips, but it doesn't work.
My source code is like this:

Code:
<input id="alarmType" name="alarmType" class="easyui-combobox"
data-options="panelHeight:'250', editable:true, valueField:'value', textField:'text', multiple:true,
icons:[{
        iconCls:'icon-ok', id: 'alarmTypeSelectAll',
        handler:function(e){
          var c = $(e.data.target);
          var opts = c.combobox('options');
          var index = opts.valueField;
          $.map(c.combobox('getData'), function(row){
            c.combobox('select', row[index]);
          })
        }
      },{
        iconCls:'icon-clear', id: 'alarmTypeUnSelectAll',
        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])
          })
        }
      }]"/>


Code:
$("#alarmTypeSelectAll").tooltip({position:'left', content: 'selectAll'});
$("#alarmTypeUnSelectAll").tooltip({content: 'unSelectAll'});


Title: Re: How to add tooltip for the icon of a combobox
Post by: jarry on December 06, 2014, 06:03:53 AM
The icon does not accept the 'id' property, but you can call 'getIcon' method instead to get the specified icon and apply the tooltip on it.
Code:
$('#alarmType').textbox('getIcon',0).tooltip({position:'left', content: 'selectAll'});
$('#alarmType').textbox('getIcon',1).tooltip({content: 'unSelectAll'});


Title: Re: How to add tooltip for the icon of a combobox
Post by: JohnWang on December 06, 2014, 06:38:52 AM
Thank you,Jarry! It works!