In the jstree plugin there is a function like this :
this.check_node = function (obj, e) {
if(this.settings.checkbox.tie_selection) { return this.select_node(obj, false, true, e); }
// Removed code for readability
};
So for the check_node
I have to pass a list of arguments, the list of arguments I have to pass are in an array, so I do as following :
scope.jstree(true).check_node(...scope.args['check_node']);
Where scope.args['check_node']
contains the list of args I want to pass to check_node
, doing this with spread operator won't raise any error, but for a reason I can't work with ES6 syntax and I'm stuck with ES5, so I had to use apply
instead as following :
scope.jstree(true).check_node.apply(null, scope.args['check_node']);
But this will throw the following error :
TypeError: Cannot read property 'settings' of null
which is in this line :
if(this.settings.checkbox.tie_selection)
Why apply in this case is throwing the error and the spread oprator is not ? and how can I solve this ?