IBM Worklight: BusyIndicator not showing

210 Views Asked by At

I'm trying to show a BusyIndicator, but when I run the project it doesn't show. This is my main.js:

var busyInd;

function wlCommonInit() {
    busyInd = new WL.BusyIndicator('content', {text : 'Loading...'}); 
    mostraDialogo(true);
}

function mostraDialogo(on) {
    if (on)
        busyInd.show();
    else
        busyInd.hide();
}

What's wrong?

1

There are 1 best solutions below

0
On BEST ANSWER

You probably do not have a content ID in your HTML.

I've replaced

busyInd = new WL.BusyIndicator('content', {text : 'Loading...'});

With

busyInd = new WL.BusyIndicator(null, {text : 'Loading...'});

And I could see the busy indicator.
I also added a DIV with a content ID to the HTML, and it worked as well.

When testing in actual devices or simulator/emulator, the ID parameter is not required because it uses a native busy indicator. When testing in the MBS, the ID parameter is required because a web busy indicator is used, and it must be anchored to an existing element (or to null).