jeudi 28 mai 2015

Ckeditor incorrectly display checkbox

I created custom widget that combines checkbox and label elements into one. Both of these elements can be edited in dialog, but sometimes checkbox doesn't change from checked to unchecked and vice versa, when looking at html everything is correct.

Code that is used to change checkbox state:

data: function () {
  var checkbox = this.element.findOne('.checkbox-value');
  if (checkbox != null) {
    if (this.data.isChecked && !checkbox.hasAttribute('checked')) {
      checkbox.setAttribute('checked', 'checked');
    } else if (!this.data.isChecked && checkbox.hasAttribute('checked')) {
      checkbox.removeAttribute('checked');
    }
  }
}

Incorrectly displayed checkbox

I am unable to reproduce this situation 100%, sometimes one checkbox don't change its state, but all other checkboxes work just fine. After saving content and reloading page checkbox state is set correctly, but after changing it don't change.

If label text was changed it always updates text.

It seemed like some caching problem, but why only some checkboxes are not updates?




Aucun commentaire:

Enregistrer un commentaire