Fix impostazione JS dinamica per checkbox

This commit is contained in:
Dasc3er 2021-09-21 15:34:07 +02:00
parent 324607a116
commit dee3e9b3b5
1 changed files with 9 additions and 0 deletions

View File

@ -287,12 +287,21 @@ Input.prototype.get = function () {
* @returns {Input}
*/
Input.prototype.set = function (value) {
const previous = this.get();
// Gestione dei valori per l'editor
if (this.element.hasClass("editor-input") && typeof CKEDITOR !== 'undefined') {
const name = this.element.attr("id");
CKEDITOR.instances[name].setData(value);
} else {
this.element.val(value).trigger("change");
// Impostazione valore per checkbox
let group = this.element.closest(".form-group");
const checkbox = group.find("input[type=checkbox]");
if (checkbox.length && parseInt(value) !== previous) {
checkbox.click();
}
}
return this;