EasyUI Forum
November 05, 2025, 11:06:34 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 editor in datagrid, pressing down arrow key to activate dropdown  (Read 9114 times)
rockccf
Newbie
*
Posts: 8


Ignorance is bliss.


View Profile
« on: June 02, 2015, 03:00:43 AM »

Hi,

About the combobox editor in datagrid, how to bind the down arrow key so whenever user press the down arrow key, the drop down will show, but when the drop down is displayed, up/down arrow key acts as default.
Currently the drop down list has to be triggered by using mouse and click on the cell.

It's a non-editable combobox.

Thanks.
« Last Edit: June 02, 2015, 03:05:32 AM by rockccf » Logged
jarry
Administrator
Hero Member
*****
Posts: 2300


View Profile Email
« Reply #1 on: June 02, 2015, 09:23:59 AM »

Bind the 'keydown' event to the editing box. if the user press the DOWN key, call the 'showPanel' method to display the drop-down panel.
Code:
$('#dg').datagrid({
onBeginEdit: function(index,row){
var ed = $(this).datagrid('getEditor', {index:index,field:...});
if (ed){
$(ed.target).combobox('textbox').bind('keydown', function(e){
if (e.keyCode == 40){
var cc = $(ed.target);
if (cc.combobox('panel').panel('options').closed){
cc.combobox('showPanel');
}
}
})
}
}
})
Logged
rockccf
Newbie
*
Posts: 8


Ignorance is bliss.


View Profile
« Reply #2 on: June 02, 2015, 08:44:46 PM »

Great!
It works.
Thank you so much.
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!