EasyUI Forum
May 17, 2024, 04:25:18 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: combobox/datebox: how to manage click on the icon (arrow)  (Read 8827 times)
korenanzo
Guest
« on: October 20, 2015, 07:34:58 AM »

Hi,

I need to manage the click event on the down arrow (or calendar icon )  button, on comboboxes and dateboxes.

Following http://www.jeasyui.com/forum/index.php?topic=4790.0 , I tried something like:
Code:
$.extend($.fn.combobox.defaults, {
 
icons:[{
  handler:function(e){
console.log ("STICLICK");
}
}]
})

but it doesn't work.

So, which is the correct way to reach my goal?

thanks,

Ric

Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #1 on: October 20, 2015, 05:44:52 PM »

You can hide the original down-arrow icon and customize the new 'icons' to achieve the same functionality.
Code:
$.extend($.fn.combobox.defaults, {
hasDownArrow: false,
icons: [{
iconCls:'combo-arrow',
handler:function(e){
var target = e.data.target;
var panel = $.data(target, 'combo').panel;
if (panel.is(':visible')){
$(target).combo('hidePanel');
} else {
var p = $(target).closest('div.combo-panel'); // the parent combo panel
$('div.combo-panel:visible').not(panel).not(p).panel('close');
$(target).combo('showPanel');
}
$(target).combo('textbox').focus();
}
}]
})

If you only want to get the click event on the down-arrow icon, please use the 'onClickIcon' event instead.
Code:
$('#cc').combobox({
onClickIcon: function(index){
var icon = $(this).combobox('getIcon', index);
if (icon.hasClass('combo-arrow')){
console.log('clicked the down arrow icon.')
}
}
})
« Last Edit: October 20, 2015, 05:50:32 PM by jarry » Logged
korenanzo
Guest
« Reply #2 on: October 20, 2015, 11:57:57 PM »

Quote
If you only want to get the click event on the down-arrow icon, please use the 'onClickIcon' event instead.

Oh, that's my way!

It works, thanks

It seems an undocumented event :O I haven't found it on the manual ...

I can suppose there could be lots of them... is there a way to find them?

Thanks, RIc
« Last Edit: October 21, 2015, 12:02:50 AM by korenanzo » Logged
jarry
Administrator
Hero Member
*****
Posts: 2264


View Profile Email
« Reply #3 on: October 21, 2015, 01:37:59 AM »

The combobox extends from textbox. All the events defined in textbox can be used in the combobox.
Logged
korenanzo
Guest
« Reply #4 on: October 21, 2015, 01:44:38 AM »

Ah ok, my fault Smiley
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!