EasyUI Forum
April 26, 2024, 05:56:45 AM *
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 width attribute  (Read 4017 times)
galcott
Newbie
*
Posts: 39


View Profile
« on: April 15, 2022, 08:58:08 AM »

On the combobox, the width property doesn't seem to work. If I use this code:
Code:
<SELECT class='easyui-combobox' panelHeight='auto' label='Category' editable=false labelWidth=90 width=320>
the combo looks like this:

http://galcott.com/combo1.jpg

I have to use a style tag to get the width to work.
Code:
<SELECT class='easyui-combobox' panelHeight='auto' label='Category' editable=false labelWidth=90 style='width: 320px'>
Then it works properly like this:

http://galcott.com/combo2.jpg


That doesn't seem like the way it's supposed to work. Is there an issue with the width property?


« Last Edit: April 15, 2022, 09:59:18 AM by galcott » Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: April 15, 2022, 11:49:28 PM »

Put these properties to the 'data-options' attribute.
Code:
<SELECT class='easyui-combobox' panelHeight='auto' label='Category' editable=false data-options="width:320,labelWidth:90">
</SELECT>
Or
Code:
<SELECT class='easyui-combobox' data-options="width:320,labelWidth:90,label:'Category',editable:false,panelHeight:'auto'">
</SELECT>

If you really want to use the 'width' attribute on the element, please override the $.fn.combobox.parseOptions function to support it.
Code:
<script type="text/javascript">
(function($){
var oldParser = $.fn.combobox.parseOptions;
$.fn.combobox.parseOptions = function(target){
return $.extend({},
$.parser.parseOptions(target, [{width:'number'},{height:'number'}]),
oldParser.call(this,target)
);
}
})(jQuery);
</script>

Now the code below works well.
Code:
<SELECT class='easyui-combobox' panelHeight='auto' label='Category' editable=false labelWidth=90 width=320>
</SELECT>
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!