Skip to main content

Integration, Extension & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
CUSTOMERS ONLY: Now accepting customer applications for the 2023 Luminary Program: SUBMIT NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
fduchmann
Partner - Contributor III
Partner - Contributor III

AngularJS-based visualization extensions, validated events gets fired multiple times

Hello Qlik Community,

When using the 02-AngularJS-Basics Extension from Stefan Walters Github Page and navigating between the sheets, the Validated Events gets fired mutiple times.

Steps to reproduce:

  1. Download and Deploy the 02-AngularJS-Basics Extension on the Desktop Version of Qlik Sense (September Version)
  2. Add the function provided by the Qlik Sense Documentation ‌to do something if the data is ready. (See picture 1)
  3. Create a sheet with the extension on it (1), and a second sheet to navigate to (2)
  4. Open Sheet 1 and open the Chrome Developer Tools
  5. Navigate to Sheet 2
  6. Navigate back to Sheet 1
  7. Make a selection
  8. --> Validated Events gets fired 2 times (Picture 2)

Unbenannt.PNG

Picture 1

Unbenannt2.PNG

Picture 2

So as far as I understand everything I write in this function (between the bind brackets) gets executed twice?!

How can the function be only executed once, when the data is ready?

Best regards,

Frank

3 Replies
ErikWetterberg

Hi Frank,

Validated event should be called twice: once when the sheet is opened, and once when the selection is made (provided you really only make one selection and not several in step 7). If the calculation behind the object is slow and the steps happen quickly (like programatically) the initial getLayout might get aborted and there will be only one Validated event.

If you want to avoid this you should make selections first and show the object after that. This is a common (and recomended) technique in mashups, where you want to have an initial selection when you display an object, used for example in single.

Erik Wetterberg

https://extendingqlik.upper88.com/

fduchmann
Partner - Contributor III
Partner - Contributor III
Author

Hey Erik,

ok this makes sense that the validated event is fired when the sheet is opened and a selection is done.

What confuses me is when I switch for example 3 times between sheet 1 <-> sheet2 (step 5 and 6) and then go back to sheet 1 and make ONE selection the validated event gets fired 3 times ( in general the number of switching between the sheets + 1).

As far as I understand should the validated event be fired only 2 times (sheet opened + data ready).

This is realy bad for large computations inside $scope.component.model.Validated.bind.

Is there a method to prevent this?


Best Regards

Frank

Unbenannt3.PNG

ErikWetterberg

HI,

I don’t really use this pattern, but it might be that your callback gets bound multiple times, once every time you go to the sheet. You probably need to unbind when the extension is destroyed. Or you could use paint.

Erik Wetterberg

Extending Qlik – Use Qlik in your own apps and sites