EasyUI Forum
May 04, 2024, 10:55:51 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: readonly style problem with combobox, datebox that extendes textbox  (Read 17026 times)
Stefan B.
Full Member
***
Posts: 152


Software Architekt


View Profile Email
« on: January 12, 2015, 05:20:08 AM »

Hello. We defined a color for readonly textbox componend's with the easyui CSS for textbox-readonly

Code:
.textbox-readonly {
  background-color : #bcbcbc;
}
 
.textbox-text-readonly {
    background-color : #bcbcbc;
}

That works fine for textboxes that are marked with readonly = true.

But components like combobox and datebox also show the readonly color, but they are not set to readonly, they only set editable=false flag!
Code:
	$('#svEdPurchaseDate').datebox({
width:'140',
editable: false,
readonly: false
});


But not editable components should not shown with the readonly color!
This looks like a bug?!

Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: January 12, 2015, 08:28:25 AM »

If a combo component has 'editable' property set to false, it will not be edited, The input box is read-only, it has the same CSS style with the readonly input.
Logged
Stefan B.
Full Member
***
Posts: 152


Software Architekt


View Profile Email
« Reply #2 on: January 12, 2015, 08:58:23 AM »

Yes that is correct, but for me it is not so the same, so we would use a different style for readonly and not editable.

How can we handle this?

the readonly flag of the component disable the form field
i mean this is not the same and should have different css classes ...
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #3 on: January 12, 2015, 07:12:44 PM »

Only the disabled component disable the form field. The readonly field only set its input box to noneditable.

The non-editable and readonly combo components have the same effect, they all prevent users from editing the input box, they all have the same '.textbox-text-readonly' CSS style. The difference is that the non-editable combo component allows the user to click the drop-down arrow to select a new value while the readonly combo component does not.

If you really want to make the non-editable combo different from the readonly combo, please try the code below to add a new 'textbox-text-noneditable' CSS class when the 'editable' property set to false.
Code:
(function($){
var plugin = $.fn.textbox;
$.fn.textbox = function(options, param){
if (typeof options == 'string'){
return plugin.call(this, options, param);
} else {
return this.each(function(){
plugin.call($(this), options, param);
var opts = $(this).textbox('options');
$(this).textbox('textbox').removeClass('textbox-text-noneditable').addClass(!opts.editable ? 'textbox-text-noneditable' : '');
});
}
};
$.fn.textbox.defaults = plugin.defaults;
$.fn.textbox.parseOptions = plugin.parseOptions;
$.fn.textbox.methods = plugin.methods;
})(jQuery);
Logged
Stefan B.
Full Member
***
Posts: 152


Software Architekt


View Profile Email
« Reply #4 on: January 13, 2015, 12:16:20 AM »

THX for this solution  Grin
That is exactly what we search.
I test it and it works fine!
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!