EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: jpierce on September 12, 2013, 11:35:45 AM



Title: make non-editable combobox drop down on click in text region?
Post by: jpierce on September 12, 2013, 11:35:45 AM
What would be the best way to make a non-editable combobox drop down when you click on the text regions (instead of just the dropdown arrow)?


Title: Re: make non-editable combobox drop down on click in text region?
Post by: stworthy on September 12, 2013, 05:37:45 PM
Bind 'click' event handler to the textbox and call 'showPanel' method to display drop down list panel in this event handler.
Code:
var cc = $('#cc').combobox({...});  // create combobox component
cc.combobox('textbox').bind('click',function(){
  cc.combobox('showPanel');
});


Title: Re: make non-editable combobox drop down on click in text region?
Post by: jpierce on September 16, 2013, 09:26:36 AM
Thanks!  I added a little so that the click will toggle between open and closed, like most comboboxes do:
Code:
    var cc = $('#cc ');
    cc .combobox('textbox').bind('click', function() {
        if (cc .combobox('panel').parent().css('display') === 'none') {
            cc .combobox('showPanel');
        }
        else {
            cc .combobox('hidePanel');
        }
    });


Title: Re: make non-editable combobox drop down on click in text region?
Post by: arma on December 01, 2013, 04:04:43 PM
How to extend this so it applies to any combobox by default?


Title: Re: make non-editable combobox drop down on click in text region?
Post by: stworthy on December 01, 2013, 05:27:29 PM
This topic has solved this problem.
http://www.jeasyui.com/forum/index.php?topic=2481.0