EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: devnull on November 15, 2012, 10:05:54 PM



Title: Combobox Width
Post by: devnull on November 15, 2012, 10:05:54 PM
Hi;

I need to control the width of my element by className and I seem unable to do that with the comboBox.

See example on JS Fiddle, both the text input and the comboBox should be the same width controlled by .myclass, however the combobox appears to be the original .myclass width - the width of the drop down arrow.

Also, each time I call the comboBox  (clickme button) , it's width reduces by the width of the dropdown arrow.

http://jsfiddle.net/F9c2t/

Can these be fixed so that I can use classes to control the width, and that calling the comboBox does not keep shrinking it ??

Thanks


Title: Re: Combobox Width
Post by: stworthy on November 16, 2012, 12:39:33 AM
Try overriding the $.fn.combobox.parseOptions to redefine how to get the width property.
Code:
	(function($){
var po = $.fn.combobox.parseOptions;
$.fn.combobox.parseOptions = function(target){
return $.extend({},po(target),{
width: $(target).outerWidth()
});
}
})(jQuery);


Title: Re: Combobox Width
Post by: devnull on November 23, 2012, 04:38:06 AM
Hi;

Is it possible to make this the default for all the form controls as I need to add this fixe for each type of input in order to correct all their widths ??

Thanks


Title: Re: Combobox Width
Post by: stworthy on November 23, 2012, 08:13:51 PM
Please download the fixed combo plugin from http://www.jeasyui.com/easyui/plugins/jquery.combo.js. All the combo and its extended plugins will have the same default width feature.


Title: Re: Combobox Width
Post by: devnull on November 23, 2012, 08:34:41 PM
Thanks, but what I am referring to is all of the other form controls which also have the same problem:

Numberspinner, datebox, datetimebox etc etc

Thanks

I also just downloaded and tested http://www.jeasyui.com/easyui/plugins/jquery.combo.js and it does not fix the problem, however using the code snippet does.


Title: Re: Combobox Width
Post by: stworthy on November 24, 2012, 01:53:38 AM
Hi devnull,
The sample you posted works fine now. It has fixed the combobox issue.


Title: Re: Combobox Width
Post by: devnull on November 24, 2012, 02:10:54 AM
Hi;

I just re-tested the jsfiddle and it still works as previously and is not fixed.

http://jsfiddle.net/F9c2t/

Are you testing the same version as me or have you modified it ??

Also, this affects all of the other form inputs as well, see this edited version:

http://jsfiddle.net/F9c2t/2/



Title: Re: Combobox Width
Post by: stworthy on November 24, 2012, 02:36:34 AM
It also works fine. Be sure to include the combo plugin file in your page.
Code:
	<script type="text/javascript" src="../jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="../jquery.easyui.min.js"></script>
<script type="text/javascript" src="../jquery.combo.js"></script>


Title: Re: Combobox Width
Post by: devnull on November 24, 2012, 03:16:42 AM
Ahh, the reason is I copied the new jquery.combo.js over the old one in the plugins folder and expected it to work, but it didn't.

Adding the additional link to the file does fif it and I have updated jsfiddle: http://jsfiddle.net/F9c2t/3/

However, will this be included as standard into the next release ??

Many Thanks