EasyUI Forum
May 22, 2024, 02:42:51 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  (Read 23401 times)
devnull
Sr. Member
****
Posts: 431


View Profile
« 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
« Last Edit: November 15, 2012, 10:11:09 PM by devnull » Logged

-- Licensed User --
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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);
Logged
devnull
Sr. Member
****
Posts: 431


View Profile
« Reply #2 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
Logged

-- Licensed User --
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 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.
Logged
devnull
Sr. Member
****
Posts: 431


View Profile
« Reply #4 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.
« Last Edit: November 23, 2012, 09:08:06 PM by devnull » Logged

-- Licensed User --
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #5 on: November 24, 2012, 01:53:38 AM »

Hi devnull,
The sample you posted works fine now. It has fixed the combobox issue.
Logged
devnull
Sr. Member
****
Posts: 431


View Profile
« Reply #6 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/

« Last Edit: November 24, 2012, 02:19:02 AM by devnull » Logged

-- Licensed User --
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #7 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>
Logged
devnull
Sr. Member
****
Posts: 431


View Profile
« Reply #8 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
Logged

-- Licensed User --
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!