cancel
Showing results for 
Search instead for 
Did you mean: 

busyIndicator, busyDialog - How to Use in simple OData calls?

Aksel
Participant
0 Kudos

Hi experts,

I tried to show a busyDialog or busyIndicator surrounding an OData-model create:

like this:


var busyDialog4 = (sap.ui.getCore().byId("busy4")) ? sap.ui.getCore().byId("busy4") : new sap.m.BusyDialog('busy4',{text:'test', title: 'Loading'});

busyDialog4.open();

oModel.create("/EintragMenge", oData, null,

  function() {

       busyDialog4.close();

       jQuery.sap.require("sap.m.MessageToast");

      sap.m.MessageToast.show("Done");

  },

  this.confirmTimeError()

);

or like this:


sap.ui.core.BusyIndicator.show();

// oModel.create(...

sap.ui.core.BusyIndicator.hide();


I never made it to show the Dialog or Indicator...

If I tried to open it with a duration and/or delay it seemed that the Indicator is shown after the OData call is done...

Is there a special way to achieve this?

Thanks in advance

Aksel

Message was edited by: Michael Appleby

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You need to use "attachRequestSent()" and "attachRequestCompleted()" methods to your model.

Try something like this :

oModel.attachRequestSent(function(){busyDialog.open();});

oModel.attachRequestCompleted(function(){busyDialog.close();});

Regards

former_member293602
Active Participant
0 Kudos

Hi,

I would recommend to make use of the events above. If you still don't see anything, it might be due to the fact, that the system performance is "too good". When calling

sap.ui.core.BusyIndicator.show(nDelay);

you can specify a delay in milliseconds. If you don't specify anything, a default value is taken (See API Reference)

Regards, Frank

Aksel
Participant
0 Kudos

Thank you very much,

now I got small busyDialog on any model request :slightly_smiling_face:

...I will do some tryout also with the busyIndicator.

Thanks to all for your answers!

former_member193103
Participant
0 Kudos

Hi Loic,

I am facing the same problem. Can you please show me how can I use

  1. oModel.attachRequestSent(function(){busyDialog.open();}); 
  2. oModel.attachRequestCompleted(function(){busyDialog.close();});

with OModel.create().



I declare the busy dialog and use it like


BpModel.attachRequestSent(function(){busyDialog.open();}); 

      

      BpModel.create('/CreateBP', oEntry, null, function(oResponse){

      console.log(oResponse);

      BpModel.attachRequestCompleted(function(){busyDialog.close();});

      detBPDialog.open();

      

            },

But the busy dialog is not appear. Can you please show me where I went wrong???

Thanks

Himadri


former_member190655
Participant
0 Kudos

Try storing your oData model like: this.oModel

N then in Create calling -

function(uri,callback) {

this.requestSentEvent();

var fnResponse = {};

var that = this;

this.oServiceModel.read(uri, null, null, true,

  function (oData, response) {

  that.requestCompletedEvent();

   callback.call(fnResponse);

  },

  function (oError) {

   callback.call(fnResponse);

  });

};

It is not getting the handle on oData model when it is completing the call.

Try this and let me know... if it is working

Thanks,

Chet

Former Member
0 Kudos

Hi Aksel,

Could you get some way around with busy indicator. I am also trying to do the same thing with odata read call but not able to see the busy indicator.

Please suggest if you have achieved this.

Regards,

Anupriya

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi everyone,

I'm facing an issue when using

"oModel.attachRequestSent()" and "oModel.attachRequestCompleted()".

When I click on my Save-Button, it takes 1-2sec. till the BusyDialog shows up.

This is because there is some stuff to do before the "create-request" is called.

The performance is very good, so the request needs only 1second till it's completed.

But I want the BusyDialog to show up right after I click the Save-Button.

I want to get a BusyDialog even for the 1-2sec till the "create-request" is fired.

So i decided to open the BusyDialog right after the Save-Button get's clicked.

But there's no BusyDialog coming up. With a breakpoint I'm able to see the Dialog.

Does anybody know what to do or how I can solve my issue?

Thanks and Greetz

Former Member
0 Kudos

Hi Tobias,

Do you think that a LocalBusyIndicator can solve your problem ?

Regards

Former Member
0 Kudos

Hi,

how to use the LocalBusyIndicator in my case? I tried with View.setBusy() but it doesn't work.

I have no table which i could setBusy.

Regards

former_member293602
Active Participant
0 Kudos

Hi Tobias,

the LocalBusyIndicator is available for all controls including a view. Did you try to reduce the delay by calling "setBusyIndicatorDelay(1)"?

Regards, Frank

Former Member

Hi Frank,

yes I tried to reduce the delay.

The Local Busy Indicator works but not as fast as I want it.

Is there a way to keep it opened for a few seconds?

I mean:

     - BusyIndicator get's opened

     - Close BusyIndicator when fired "attachRequestCompleted" but in any case be opened at least 3 seconds even the "attachRequestCompleted"-Event is fired after 1 second.

Regards,

Tobi

Former Member
0 Kudos

I am not sure what is gone wrong can u try similar to below piece of code

var loadData = function() {

          busyDialog4.open()

          oModel.create("/EintragMenge", oData, null, 

            function() {  

                    jQuery.sap.require("sap.m.MessageToast"); 

                    sap.m.MessageToast.show("Done");

                    busyDialog4.close();

            }, 

            this.confirmTimeError() 

          ); 

}

Regards,

Ajain