How to setBusy(false) Indicator SAPUI5 for all controls at one time

1.1k Views Asked by At

we want to take care that all running busy indicators will be stopped after a couple of time. How can we do that? For the moment we use setBusy(false) for each control. Thanks a lot!

1

There are 1 best solutions below

2
StErMi On

I think that you should change your overall approach because it's not a good UI/UX pattern.

First of all, why do you have more than one busy control in your view? For instance, you if you are loading record in a list you just set busy the list, not the whole page. If you are submitting a form data, you set busy only the form not everything else.

Second of all, why do you say "For the moment we use setBusy(false) for each control"? You should remove the busy state after a specific event. For istance when you finished to load list's result or you get the result of a form submission.

Anyway, to solve your current issue, the best approach is to use XML binding with a temporary JSON model.

You could have a JSON model like with content like this:

{
    busy: false
}

and you bind the busy property of the control to youtJSONModel>/busy at this point when you need to set the control to a busy state you can do this.getView().getModel("youtJSONModel").setProperty("/busy", true); and when you have finished the operation you can do this.getView().getModel("youtJSONModel").setProperty("/busy", false);