user2076214
user2076214

Reputation: 11

BusyIndicator not working

Worklight busyindicator not working properly.My isssue is i'm using multipage.On page change i call adapter for webservice and call busy indicator so that it show work in progress while fetching.but what happen is page change and indicator show and hide quickly but adpater still in fetching phase and after sometime data called successfully but during these working no busy indicator shows.

var busyIndicator = null;

function wlCommonInit(){
    busyIndicator = new WL.BusyIndicator();
    }

This is the code i call on page change.

    busyIndicatorDemo();
    var viewPath = "views/add_fund_transfer.html";
    WL.Page.load(viewPath,
        {
                onComplete: function() {    

                PayAnyOne_Controller.GetBranches(GetBranchesProcedureName);
                busyIndicator.hide();

                }
            });

function busyIndicatorDemo() {
    busyIndicator.show();
    setTimeout(15000);
}

its seems like busyindicator doesn't work with adpater when using in multipage. Please give me the solution or the problem in my code.

Thanks.

Upvotes: 0

Views: 531

Answers (1)

uriz
uriz

Reputation: 107

It seems like the problem is in the flow of the code. you're running this code basically:

  1. show busy indicator
  2. load page
  3. when page has finished loading: invoke procedure (async call), and hide busyindicator.

So this generates the behavior you've reported - the busyindicator is shown and quickly hidden once the page has finished loading, even though the service is still fetching data (in an async call)

moving the busyindicator.hide to the onSuccess of the invoke procedure should solve the problem (put it also in the onFailure ...) Hope this helps

Upvotes: 1

Related Questions