Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm developing extension which works OK under QV10 SR2. However, under SR3 it fails because method
qva.GetQvObject("ID", callback)
calls callback function before the object is ready, despite it supposed to call it after. In my case callback function is called when a listbox doesn't yet have Data and Layout.Caption members which leads to errors and complete misfunctioning.
Questions to community:
1) Could someone please report the problem to QlikTech team, as I don't have access to Support (I'm using Personal Edition).
2) Does anybody know any workarounds how to get a function called upon change in a listbox without using callback function in GetQvObject?
Thanks.
UPDATE
QlikTech support said that this is known bug but they have no any assumptions when it will be resolved.
I stick to SR2 as to more stable release for extensions.
I think your issue sounds similar to one I recently logged to the support team.
1) Our issue was the the onUpdate event was not being called for a specificChart Object. We worked around this issue by deleting the chart andrecreating one from scratch - after we did that the onUpdate event firedproperly. The thinking is the object some how got corrupted in the .qvw. - doesn't make much sense to me but deleting the old Chart and creating a new Chart made the issue go away.
2) I don't recommend it, but if you are really wanted an alternate to on update you could hack the JavaScript to execute a function when the QvaPublic object is defined. Again, not recommended but incase you have no other options...
var myOnUpdateFunction =function () {
alert("fired");
};
var myObject =qva.GetQvObject("ch01", function () {});
var oldPaint =myObject.Paint; // make a copy of this function
myObject.Paint = function () {
oldPaint.apply(this, arguments); // call the old function
if(typeof (this.QvaPublic) !== "undefined") { // paint is where theQvaPublic api gets added on.
myOnUpdateFunction.apply(this); // call the onupdate function when the object exists.
}
};
JuliusHutzler, thanks for sharing ideas.
I played a lot with this bug and tried recreate objects also. The problem is caused by asyncronous creation of QV objects in AJAX mode -- if the object you are trying to tie to was constructed before your object -- it works fine. If not -- it fires before time. So be careful as in your case it might be just happy coincendence. In my case from 4 lisboxes in random situations either 1 or all 4 were unavailable, even if I recreated them from scratch.
Let's see if QlikTech will fix the bug in SR4. If not -- probably your solution will be the only viable case. I might only need to test it whether it can work correctly with selection change in lisboxes.