Implements set_readonly for radiobox

This commit is contained in:
Hadi Nategh 2020-05-13 11:55:22 +02:00
parent 538d25333e
commit 1dc1d07dea
3 changed files with 32 additions and 1 deletions

View File

@ -138,6 +138,18 @@ var et2_radiobox = /** @class */ (function (_super) {
}
return ok;
};
/**
* Set radio readonly attribute.
* Do not confuse this with etemplate readonly, which would use et_textbox_ro instead
* @param _readonly Boolean
*/
et2_radiobox.prototype.set_readonly = function (_readonly) {
this.getRoot().iterateOver(function (radio) {
if (radio.id == this.id) {
radio.input.prop('disabled', _readonly);
}
}, this, et2_radiobox);
};
et2_radiobox._attributes = {
"set_value": {
"name": "Set value",

View File

@ -171,6 +171,23 @@ class et2_radiobox extends et2_inputWidget
}
return ok;
}
/**
* Set radio readonly attribute.
* Do not confuse this with etemplate readonly, which would use et_textbox_ro instead
* @param _readonly Boolean
*/
set_readonly(_readonly)
{
this.getRoot().iterateOver(function(radio)
{
if (radio.id == this.id)
{
radio.input.prop('disabled',_readonly);
}
}, this, et2_radiobox);
}
}
et2_register_widget(et2_radiobox, ["radio"]);

View File

@ -2608,7 +2608,9 @@ span.et2_checkbox_slideSwitch.switchOn > span.slideSwitch_container a {
.et2_radiobox {
margin-right: 10px;
}
.et2_radiobox[disabled] {
opacity: 0.5;
}
/**
* Do not wrap content of a single widget incl. a label or children of a hbox.
* Taking into eg. select-account widget rendered as ul and prefixed with a label