1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2024-12-29 09:11:11 +01:00

Fix impostazione JS dinamica per checkbox

This commit is contained in:
Dasc3er 2021-09-21 15:34:07 +02:00
parent 324607a116
commit dee3e9b3b5

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;