Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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:
Picture 1
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
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
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
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