on 06-09-2015 6:42 AM
Hi All,
I am trying to make OData read call to get the data and I want to display a busy indicator until I get the data from backend.
To do this , I have used attachRequestSent and completed method and inside those I have used .show() and .hide() method. But these methods and never getting executed,
This is the order I have used:
Is there somthing I am missing, or the order should be something else.
PS: When I run this in debug mode, after going to line 4 its directly jumping to Line 7 skipping line 5.
Thanks in Advance!
Regards,
Anupriya
make it async
oDataModelSearch.read("/Entity",null,null,true,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Create a folder - util under Webcontent and create a file busyUtil.js inside util folder
Write the below code in busyUtil.js
_busyIndicator : null,
setBusyOn : function() {
if (!this._busyIndicator) {
this._busyIndicator = new sap.m.BusyDialog();
}
this._busyIndicator.open();
},
setBusyOff : function() {
this._busyIndicator.close();
},
---------------------------------------------------
call busy on before reading the data from backend.
util.busyUtil.setBusyOn();
------------------------------------------------------------
Set the busy off in success or failure function.
util.busyUtil.setBusyOff();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi German,
I have used it the following way and its working for me.
$.sap.declare("HR.util.Busy");
HR.util.Busy = {
_busyIndicator : null,
setBusyOn : function(opacity) {
if (!this._busyIndicator) {
this._busyIndicator = new sap.m.BusyDialog();
}
this._busyIndicator.open();
if(opacity===undefined) opacity=0;
else opacity=0.3;
$(".sapUiBLy").css('opacity',opacity);
},
setBusyOff : function() {
this._busyIndicator.close();
},
};
And I am calling this util file using HR.util.Busy.setBusyOn() and HR.util.Busy.setBusyOff() from my controller files.
Hope it helps!.
Regards,
Anupriya
Hi Anupriya,
try below:
Define busy indicator-
var busyDialog = (busyDialog) ? busyDialog
: new sap.m.BusyDialog({})
var busyCSS = new sap.m.BusyIndicator({
size : '30px'
});
when you want to show busy indicator use-
busyDialog.open();
after reading data use-
busyDialog.close();
Regards,
Bhagyashree.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bhagyashree,
I tried as you said and I could see the result in debug mode. Do we have some parameter for open() method to pass the duration for which the indicator should be shown.
As in my case I am getting the data very faster and system doesn't get the chance to show the indicator.So can we explicitly define the duration of the indicator.
Thanks!
Anupriya
Hi Anu, Try the below approach.
var dialog = new sap.m.BusyDialog({
text:'Loading Data...'
});
dialog.open();
oDataModelSearch.read(url, null, null, true, function(oData,oResponse) {
this.data= oData.results;
oModelData= oData.results;
dialog.close();
},
function(errorResponse) {
dialog.close();
console.log(errorResponse);
});
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Naveen,
I have already tried this. The problem is I am not getting the data if I keep async- true in odata read call, on the other hand I am able to get the data when I keep async- false.
So the approach you mentioned should work fine if I keep async-false?
And I want to use Busy indicator instead of Busy dialog.
Thanks!
Regards,
Anupriya
Hi Anupriya,
Sometimes the busy indicator doesnot show up properly it would be hidden behind the current window. Try adjusting the position of the standard control for busy indicator to showup.
#busyIndicator {
display: none;
position: fixed;
z-index: 999;
background: rgba(0,0,0,0.25);
width: 100%;
height: 100%;
}
#busyIndicator > div:first-child {
position: relative;
top: 38%;
left: calc(50% - 3rem);
}
assign this css class to your control.
first check if the busy indicator is shown properly on the current screen...
Hope this helps.
Thanks,
Tharun.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try like this,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.