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:
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:
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