cancel
Showing results for 
Search instead for 
Did you mean: 

How to Hide Fragment Fields dynamically in fiori app

0 Kudos

I have a requirement to hide a fragment view field in one of my fiori apps, There are no extensions available to do this!

I tried to write a hook method 'onafterrendering' in a custom container of the main view but still not able to succeed!

Could any of one you guide me to hide fragment view field dynamically in the called app?

Thanks and Regards Ranjith Rupireddy

Tried with the below code in custom control of main view ( In extension of Fiori app)

onAfterRendering : function(){

  var buttonToHide = this.getView().byId("changePictureBtn");

  buttonToHide.setVisible(false);

},

I should hide the fragment field as attached with this Question..

nabheetscn
Active Contributor
0 Kudos

The easiest way i can think of is, why don't you load/attach your fragment dynamically as done in help here relevant code shown below. You can code your own logic inside the hook method and then decide on whether add fragment to parent view or not.

var oView = this.getView();

			// create dialog lazily
			if (!this.byId("helloDialog")) {
				// load asynchronous XML fragment
				Fragment.load({
					id: oView.getId(),
					name: "sap.ui.demo.walkthrough.view.HelloDialog"
				}).then(function (oDialog) {
					// connect dialog to the root view of this component (models, lifecycle)
					oView.addDependent(oDialog);
					oDialog.open();
				});
			} else {
				this.byId("helloDialog").open();
			}
maheshpalavalli
Active Contributor
0 Kudos

nabheet.madan3 I think he is talking about some Standard application and that button is already there I guess and he wants to hide it but the information given is so less for us to guess that as well.. Ranjith Rupireddy you need to provide more information like what is the app name and is it a fiori list report app and is it the object page and other additional details..

BR,

Mahesh

nabheetscn
Active Contributor

Might be Mahesh Kumar Palavalli but the tabs description of spouse/children looks like a custom one:) But yes it can be both agree. @Ranjit please provide the details.

maheshpalavalli
Active Contributor
0 Kudos

Nabheet Madan Yeah, now I saw that 😄 It looks like custom..

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Hi Mahesh, Nabheet,

Thanks for your response!
Yes, as Mahesh said, it is a standard Fiori app( HCM apps like 'My Addresses', 'My Personal Details', My Bank Details' etc,).
It's a common fragment view used in the above 4 std Fiori apps!

I can see only one custom container extension in the main view of child apps above(HCM apps)!
tried with different methods but like above but still failed to hide the field.

maheshpalavalli
Active Contributor
0 Kudos

This is actually tricky.. So the field is getting added via the library right? and what is happening in the onAfterRendering method..? is it giving any error while accessing that field..?

BR,
Mahesh

former_member416264
Discoverer
0 Kudos

ranjith.rupireddy

We are facing a similar issue. Did you find a proper solution for this or you ended up extending the library ?

Thanks