Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ErikWetterberg

Extension API mounted method

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:

mounted:function($element,layout){

                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

https://extendingqlik.upper88.com/

1 Solution

Accepted Solutions
Alexander_Thor
Employee
Employee

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.

View solution in original post

5 Replies
ErikWetterberg
Author

Alexander_Thor
Employee
Employee

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.

ErikWetterberg
Author

Thanks!

It seems however that the this pointer is set, the backendApi is there and backendApi.model actually contains the layout.

Erik Wetterberg

http://extendingqlik.upper88.com/

salezian
Creator
Creator

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.

ErikWetterberg
Author

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

https://extendingqlik.upper88.com/