EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: gurpal2000 on August 08, 2012, 04:32:19 PM



Title: incomplete combobox behaviour when editable is false
Post by: gurpal2000 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


Title: Re: incomplete combobox behaviour when editable is false
Post by: stworthy 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>


Title: Re: incomplete combobox behaviour when editable is false
Post by: gurpal2000 on August 09, 2012, 04:05:15 PM
Truly fantastic ! thanks v much.