EasyUI Forum
June 25, 2024, 06:49:44 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: incomplete combobox behaviour when editable is false  (Read 11099 times)
gurpal2000
Newbie
*
Posts: 14


View Profile
« on: August 08, 2012, 04:32:19 PM »

Hi

if editable is false, i expected:

1. to not be able to select/highlight text in the textbox portion
2. drop down the list when the textbox portion is clicked
3. be able to see a pointer icon when selecting things in the dropdown list

in many ways act like a html 'select/option' item.

how can the above be achieved with the easy ui one?

thanks
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: August 08, 2012, 05:46:02 PM »

1. To disable selecting feature when editable is false, please overwrite the combobox keyHandler:
Code:
(function($){
var upHandler = $.fn.combobox.defaults.keyHandler.up;
var downHandler = $.fn.combobox.defaults.keyHandler.down;
$.extend($.fn.combobox.defaults.keyHandler,{
up: function(){
var opts = $(this).combobox('options');
if (opts.editable){upHandler.call(this)}
},
down: function(){
var opts = $(this).combobox('options');
if (opts.editable){downHandler.call(this)}
}
});
})(jQuery);

2. click the textbox to show the drop down panel:
Code:
$('#cc').combobox('textbox').bind('click',function(){
$('#cc').combobox('showPanel');
});

3. change the css definition to display the cursor arrow when moving mouse over the selecting items:
Code:
<style>
.combobox-item{
cursor:default;
}
</style>
Logged
gurpal2000
Newbie
*
Posts: 14


View Profile
« Reply #2 on: August 09, 2012, 04:05:15 PM »

Truly fantastic ! thanks v 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!