I'm using treeview from Backbone using Marionette.
I initialize the treeview when I call the view render method.
View.myPanel = Marionette.ItemView.extend(
{
render: function () {
this.treeview = this.$el.find("#treeview").kendoTreeView({
dataSource: this.hierarchicalDataSource,
dataTextField: ["item"],
dragAndDrop: true,
loadOnDemand: false,
drop: this.onDrop
}).data("kendoTreeView"),
this.treeview.expand(".k-item");
},
onDrop: function (e) {
...
code to create model goes here ......
...
this.saveItem(localModel, false);
}
}
The problem I have is that when I try and call this.saveItem, I have no reference to this. which normally would be the view itself. Instead "this" refers to the treeview object itself. I tried to extend the trreview with BackBone.Events but that causes me to lose the drag and drop functionality, I also tried passing the view object as a parameter to the drop handler but that replaces the event parameter in the onDrop function.
Any help would be appreciated, thanks!
I initialize the treeview when I call the view render method.
View.myPanel = Marionette.ItemView.extend(
{
render: function () {
this.treeview = this.$el.find("#treeview").kendoTreeView({
dataSource: this.hierarchicalDataSource,
dataTextField: ["item"],
dragAndDrop: true,
loadOnDemand: false,
drop: this.onDrop
}).data("kendoTreeView"),
this.treeview.expand(".k-item");
},
onDrop: function (e) {
...
code to create model goes here ......
...
this.saveItem(localModel, false);
}
}
The problem I have is that when I try and call this.saveItem, I have no reference to this. which normally would be the view itself. Instead "this" refers to the treeview object itself. I tried to extend the trreview with BackBone.Events but that causes me to lose the drag and drop functionality, I also tried passing the view object as a parameter to the drop handler but that replaces the event parameter in the onDrop function.
Any help would be appreciated, thanks!