Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am trying to use the relatively new (April 2018) mounted method in the extension API. According to the documentation it has two parameters:
mounted($element, layout)
However when I try to implement it:
console.log('mounted',layout,this);
}
I get the following in the console:
mounted undefined DefaultView {_super: undefined, $scope: t, $element: w.fn.init(1), options: {…}, backendApi: GenericApi, …}
So it seems like the second parameter is undefined.
Is this a bug? Or is the documentation wrong? Or am I doing something wrong??
Erik Wetterberg
The docs are wrong, that method gets called when the object has been mounted onto the DOM but prior to any data has been fetched. Thanks for letting us know.
Any feedback on this? aaz ?
ERik
The docs are wrong, that method gets called when the object has been mounted onto the DOM but prior to any data has been fetched. Thanks for letting us know.
Thanks!
It seems however that the this pointer is set, the backendApi is there and backendApi.model actually contains the layout.
Erik Wetterberg
Hi Guys,
So is there any way to get the layout object using this method ? I'd like to use it to make default selection on sheet open.
Thanks in advance for your reply.
Hi,
Haven't tested any more, I ended up using paint() and a flag, like this;
paint: function($element,layout){
if(!this.initialized){
this.initialized = true;
//do whatever
}
Not sure about your case, though. You will need to test all scenarios and that the method is called when expected. It would probably be difficult to get this stable.
Erik Wetterberg