binds a function to an object
code | function | the function that will be bound |
master | object | the object which the function will be bound to |
function | the bound function |
var grid = webix.ui({
view:"datatable",
on:{
"onStoreUpdated":webix.bind(this.render, this)
}
});
//'this' refers to a datatable object
Inside the function the this keyword becomes a reference to the object scope.
Function and component binding works as well during attaching the function with an attachEvent method:
grid.attachEvent("onStoreUpdated", webix.bind(this.render, this));
//'this' is still a grid object since attachEvent() is called from it
Back to top