cancel
Showing results for 
Search instead for 
Did you mean: 

busyDialog responds to slow

Former Member
0 Kudos

Hi,


I have a sap.m.BusyDialog coupled to my odatamodel using the 'attachRequestSent' method.


var oModel = new sap.ui.model.odata.ODataModel(

                                sServiceUrl, false);

oModel.attachRequestSent(function() {

      busyDialog.open();

});

oModel.attachRequestCompleted(function() {

      busyDialog.close();

});


The dialog shows up to late, when the new data is almost loaded. I want the busydialog to pop up right at the moment when I press the button.


Anyone who can help me?


Kind regards,


RW

Accepted Solutions (1)

Accepted Solutions (1)

jmoors
Active Contributor
0 Kudos

Have you tried moving the open method into your button event?

The RequestSent event is only fired once the data request is made, so depending on when you create the model it could be loading the metadata etc. before you display the busy dialog?

Regards,

Jason

Former Member
0 Kudos

Hi,

Yes I tried that:

var feeder = new sap.ui.ux3.Feeder("Feeder", {

                            submit : function(){

                                busy.open(0);

                                oController.sendMessage();

                            }

});

If I would delete this line "oController.sendMessage();", the busy dialog opens immediatly, how it should be.

Kind regards,

RW

former_member189945
Contributor
0 Kudos

What if you wrap sendMessage into setTimeout?

setTimeout(function() { oController.sendMessage(); }, 0);

Regards,

Kimmo

Former Member
0 Kudos

Hi,

Looks like it's working Thanks Kimmo!

Robbe

former_member189945
Contributor
0 Kudos

Glad that was helpful.

Here's a link to Stackoverflow explaining setTimeout with 0 delay:

http://stackoverflow.com/questions/779379/why-is-settimeoutfn-0-sometimes-useful

Regards,

Kimmo

Former Member
0 Kudos

I was wrong, something went wrong with my gateway call.

former_member189945
Contributor
0 Kudos

Just to test, does it work if you increase the setTimeout delay from 0 -> 2000?

Regards,

Kimmo

Former Member
0 Kudos

Hi Kimmo,

It works if I increase the delay. BUT: now all lines are concatenated, so it seems like the getMultiLineText function doesn't work anymore. Any idea why?

Regards,

RW

former_member189945
Contributor
0 Kudos

Could you post the code of getMultiLineText and also code from where it is called?

Regards,

Kimmo

Former Member
0 Kudos

It work now. Thanks again Kimmo

former_member189945
Contributor
0 Kudos

OK, good that it's working now.

Note: setTimeout is not be optimal solution as there is still a possibility for a "race condition" where even 2000 milliseconds is not enough.

Regards,

Kimmo

Answers (1)

Answers (1)

former_member189945
Contributor
0 Kudos

Hi Robbe,

I'm more familiar with JSONModel but does it open immediately if you open the busyDialog before initializing ODataModel?

busyDialog.open();

var oModel = new sap.ui.model.odata.ODataModel(

                                sServiceUrl, false);

oModel.attachRequestCompleted(function() {

      busyDialog.close();

});

Of course, then you would have to remember to open the dialog every time a request is sent.

Regards,

Kimmo

Former Member
0 Kudos

Hi Kimmo,

I just tried it with no success... Anyways thanks for the suggestion.

Kind regards,

RW