cancel
Showing results for 
Search instead for 
Did you mean: 

BusyIndicator for synchronous model

former_member182374
Active Contributor
0 Kudos

Hello Experts,

I'm using a JSONModel in my SAPUI5 application.

The model data loading mode is synchronous and because of that I cannot use busyDialog (js is single threaded etc...).

I can change to model mode to asynchronous but in this case I'll have to use nested callbacks.

Can someone suggest a solution that avoids "callbacks hell" or still use synchronous model AND busy dialog.

Regards,

Omri

Accepted Solutions (0)

Answers (2)

Answers (2)

Qualiture
Active Contributor
0 Kudos

There should be no need for nested callbacks (only single callbacks) and I would avoid synchronous calls like the plague, because of the single threading issues you mentioned

Maksims approach should work just fine

former_member182372
Active Contributor
0 Kudos

very true,

fireRequestSent

fireRequestCompleted

fireRequestFailed


a lot of flexibility

former_member182372
Active Contributor
0 Kudos

var bd = new sap.m.BusyDialog();

bd.open();

                 

new sap.ui.model.json.JSONModel().loadData(

"http://adobe.github.io/Spry/data/json/object-02.js", null, false);

bd.close();

doesnt work???

former_member182374
Active Contributor
0 Kudos

Hi Maksim,

It doesn't work.

I don't get any dialog display nor error message.

Regards,

Omri

former_member182372
Active Contributor
0 Kudos

try

var bd = new sap.m.BusyDialog();

jQuery.sap.delayedCall(200, this, function () { bd.open(); });

new sap.ui.model.json.JSONModel().loadData(..., null, false);

bd.close();

former_member182374
Active Contributor
0 Kudos

No it opens but it doesn't close )-:

former_member182372
Active Contributor
0 Kudos

rrrr...

var bd = new sap.m.BusyDialog();

jQuery.sap.delayedCall(200, this, function () { bd.open(); });

try

{

     new sap.ui.model.json.JSONModel().loadData(..., null, false);

     bd.close();

}

catch(e){

     bd.close();

}

former_member182374
Active Contributor
0 Kudos

Still doesn't work - the busyIndicator is opened and not getting closed.

I tried setting delay for the 'bd.close()'  but in this case the dialog is not displayed at all.

I can't make a JSBIN example because this kind of issue requires backend )-:

former_member182372
Active Contributor
former_member182374
Active Contributor
0 Kudos

Thanks Maksim.

Your jsbin works so I guess there is something wrong with my design.

Thanks again for your effort. Points awarded.

Omri