Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to wait until ListBox is loaded completely?

Hi,

We have a QlikView Extension Object which depends on 1 ListBox.

$(document).ready() is used to wait until the document is loaded, and then we do our extension's initialization logic.

However, even when the document is ready, the ListBox.Data has not been loaded.

Using a callback in the form of GetObject('LB_listbox', function() { alert('listbox updated' });

does not work (no alert pops up) for the very first time the whole .qvw document is loaded.

Subsequent updates to the listbox pop up the alert box.

Question:

How do I wait until the ListBox is loaded completely?

Meaning its ListBox.Data has been populated, and all methods in ListBox.Data.* ( e.g. SelectTexts() ) are available?

Qva.AddExtension("our_ext", function () {

        //wait for the whole document to load

        $(document).ready(function () {

            if (window.IntraMapsQV_first_time === true) {

                //alert('first time');

                //Listbox.Data only have IsDataFetched(), no other functions

                debugger;

                window.IntraMapsQV_first_time = false;

            }

            else {

                //alert('second or x time');

            }

...

Many thanks

2 Replies
TKendrick20
Partner - Specialist
Partner - Specialist

Were you able to figure this out?

tschollqlikview
Partner - Contributor III
Partner - Contributor III

Hey there.

I had the same problem.

Since the data of the Listbox is loaded via AJAX you have to check the status of the object and not of the page.

Try this:

var doc = Qv.GetCurrentDocument(); // Your QV doc

                    var lb = doc.GetObject("LB01"); // the ID of your Listbox  Object

                    lb.SetOnUpdateComplete(function() { // WHEN teh data is loaded

                            for (var i = 0; i<lb.Data.Rows.length; i++) { //access the data

                                  //.... your code

                            }

                    });

Hope this helps.