Thank you Benjamin.
How can I handle these events? Apart from the updateView() that is automatically being called, is there any other way to subscribe to these events?
Any of those events can be subscribed to by subscribing to the
application class (see my example below).
Also, is there any event that will be called every time a snippet is brought to focus? What if I need to make a small change whenever a snippet was brought to focus?
Thanks,
Icarus
The widget fires the focusView event whenever it receives focus. You could listen for that by defining a focusView listener in your view, just like you do with your updateView:
CODE
focusView: function () {
//do stuff here;
},
updateView: function () {
this.controls.grid.changeDataset(API.spotlight("spotlight").dataset);
},
But you probably want to listen for when the view is selected. You could put this in your init.js script:
CODE
(function (event) {
//you can switch on the viewId by inspecting the payload;
if (event.payload.viewId === "snippet-Main") {
//you have a reference to the view in the event's payload;
event.payload.view.controls.anchorImage.element.hOffset = 20;
}
}).subscribeTo(KONtx.application, "onSelectView");
Hope that helps.