cancel
Showing results for 
Search instead for 
Did you mean: 

JS SetTimeOut Function not working in SAPUI5 application

bhaskar_india
Participant
0 Kudos

Hi UI5ers,

I am trying to use settimeout method in my view controller. But the timeout method is never called.

Any reason why JS native methods cannot be used in Ui5? Or Am I using it wrongly?

Thanks,

Bhaskar

maheshpalavalli
Active Contributor

Please paste your code?

View Entire Topic
maheshpalavalli
Active Contributor

Hi Bhaskar B,

Instead of setTimeout, use the SAP provided functions:

jQuery.sap.intervalCall(500, this.hidePanelAgain, this)

https://ui5.sap.com/1.56.15/#/api/jQuery.sap/methods/jQuery.sap.intervalCall

BR,

Mahesh

bhaskar_india
Participant
0 Kudos

Hi Mahesh,

It worked, thanks!

	onItemSelected: function(oEvent)
		{
					Msg.show("Item Selected");
		 var sPath = oEvent.getSource().getBindingContext().getPath();
		 var oProductDetailPanel=this.byId("productDetailsPanel");
		 oProductDetailPanel.bindElement({path:sPath});
		 this.byId("productDetailsPanel").setExpanded(true); 
		 //setTimeout(this.hidePanelAgain, 3000);
 		jQuery.sap.intervalCall(3000, this , "hidePanelAgain", [this]);
		},
		
		hidePanelAgain: function(passedthis)
		{
			passedthis.byId("productDetailsPanel").setExpanded(false);
		}
		

One question though: setTimeout will never work in the controller or even HTML page?

Thanks,

Bhaskar