$setVaue bug in webix 7.1.2

edited January 21 in Technical questions

Hi, until yesterday I was using webix 7.0.4, then I downloaded the new version 7.1.2 and, in certain conditions, I got an exeptions in the $setValue function.

Here yuo can see the error:
https://ibb.co/cX48Sw4
The exeption in english says something like: "0x800a138f - Javascript runtime error: Impossible to get the 'value' property of undefined".
In this case, "node" is undefined.

I analyzed the old (working) and new (not working) function $setValue where i was getting the error.

This is the 7.0.4 function: (row 28165 of webix.js)

$setValue: function (value) {
  if (!this._rendered_input) return;
  var text$$1 = value;
  var popup = this.getPopup();
  if (popup) text$$1 = this.getPopup().getItemText(value);

  if (!text$$1 && value && value.id) {
    //add new value
    var _popup = this.getPopup();

    var list = _popup.getList(); // add new item only when item with such id doesn't exists yet


    var exists = list.exists(value.id);
    if (!exists) list.add(value);
    text$$1 = _popup.getItemText(value.id); // in case of dynamic list, we can't add extra items
    // to not interfere with dynamic loading

    if (list._settings.dynamic && !exists) list.remove(value.id);
    this._settings.value = value.id;
  }

  var node = this.getInputNode();
  if (isUndefined(node.value)) node.innerHTML = text$$1 || this._get_div_placeholder();else node.value = text$$1 = text$$1.replace(/<[^>]*>/g, "");
  this._settings.text = text$$1;
}

This is the 7.1.2 function: (row 28270 of webix.js)

$setValue: function (value) {
  var text$$1 = value;
  var popup = this.getPopup();
  if (popup) text$$1 = popup.getItemText(value);

  if (value && value.id) {
    //add new value
    var list = popup.getList();
    var exists = list.exists(value.id); // add new item only when item with such id doesn't exists yet

    if (!exists) list.add(value);
    text$$1 = popup.getItemText(value.id); // in case of dynamic list, we can't add extra items
    // to not interfere with dynamic loading

    if (list._settings.dynamic && !exists) list.remove(value.id);
    this._settings.value = this.$prepareValue(value.id);
  }

  var node = this.getInputNode();
  if (isUndefined(node.value)) node.innerHTML = text$$1 || this._get_div_placeholder();else node.value = text$$1 = text$$1.replace(/<[^>]*>/g, "");
  this._settings.text = text$$1;
}

The 2 functions are very similar but I noticed that in the new function this first row is missing:

if (!this._rendered_input) return;

I added this row to the 7.1.2 function and now it works fine, just like before.

My question is if you can add back that row in future releases because if not I should add manually that row everytime i update my webix version.

I tried to create a snippet to reproduce the error but it's a very complex page and I couldn't do it, sorry.

Thank you for your answer.

*** EDIT ***

I just find out another error like the previous one:

_focus function 7.0.4: (row 3566 of webix.js)

_focus: function (e, dont_clear) {
  var view = locate(e,
  /*@attr*/
  "view_id") || this._focus_was_there; //if html was repainted we can miss the view, so checking last processed one


  view = $$(view);
  this._focus_was_there = null; //set timer, to fix issue with Android input focusin

  state._focus_time = new Date();
  if (view == this._view) return;
  if (!dont_clear) this._focus_was_there = null;

  if (view) {
    view = $$(view);

    if (this.canFocus(view)) {
      this.setFocus(view);
    }
  } else if (!dont_clear) this.setFocus(null);

  return true;
}

_focus function 7.1.2: (row 3730 of webix.js)

_focus: function (e) {
  var view = locate(e,
  /*@attr*/
  "view_id") || this._focus_was_there; //if html was repainted we can miss the view, so checking last processed one


  view = $$(view);
  this._focus_was_there = null; //set timer, to fix issue with Android input focusin

  state._focus_time = new Date();
  if (view == this._view) return true;

  if (view) {
    if (this.canFocus(view)) {
      this.setFocus(view);
    } //remove focus from an unreachable view
    else e.target.blur();
  } else this.setFocus(null);

  return true;
}

When i click on a day of a normal datepicker like this:

{
id: "txt_inizio_non_verificati",
view: "datepicker",
label: "Non verificati da",
name: "data_inizio_allarmi_non_verificati",
stringResult: true
}

I get this error:
https://ibb.co/3Nw5NRL
The exeption in english says something like: "0x8000ffff - Javascript runtime error: Unexpected call to the access property or method".

If I remove that row (note that in the 7.0.4 version that row didn't exist), everything works fine.

Actually this error does not cause any problem, but still I would like to don't have it.

*** EDIT 2 ***
The second error is only on IE 11, the first one is also on google chrome

Comments

  • edited January 23

    Hi Andrea,

    We are aware of this regression, and are currently working on the fix, but any sample/code snippet of the first issue would be nice.

    As to the datepicker bug in IE 11 - we can confirm the problem and will try to provide a fix in one of the next builds.

  • Hi Helga,

    thank you for your answer, here there is a snippet with something similar to what I have:

    https://snippet.webix.com/b7gth2mz

    This is not exactly my case, but the cause of the problem seems to be the same.

    At the start i was thinking that the problem were that i was loading the values when the view was still hidden, but in these very similar snippets:

    https://snippet.webix.com/ay04ig9x
    https://snippet.webix.com/ilcbb3r3

    everything works fine while the values are still loaded when the view is hidden.

    I hope this can help you.

    Please let me now if you have any news about this problem, thank you.

  • edited January 24

    Hi Andrea,

    You can check the 7.1.3 build - both fixes were included into it.

  • Hi Helga,

    I tried the new build and it worked perfectly!

    Thanks a lot!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!