cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic App Title for Fiori Apps

former_member204167
Participant
0 Kudos

Hi Experts,

I want to manipulate the app title (red box on screenshot below) at runtime for an app I have recently developed:

The title marked in red is coming from the manifest.json of my application (it actually refers to the i18n model):

I have not found any way to change the title (red box first screenshot) at runtime (e.g. depending on start up parameters of the app). It seems to be a read only property at the manifest object that is unchangeable.

Any help/ideas appreciated.

Regards

Tobias

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member227918
Active Contributor

if title is coming from i18n then, to change i18n labels is not a good idea, since this is static text you can have as many static text i.e. appTitle=title1, appTitle1=title2

var oBundle = get your i18n model here
var title = "";
if(condition){
  title = oBundle.getText("appTitle");
}else {
  title = oBundle.getText("appTitle1");
} 
var oModel = new JSONModel({ pageTitle: title});
now bind this model with property title 

title="{/pageTitle}" 
0 Kudos

Hi Akhilesh,

I tried your solution for my requirement, and I am faced with some errors, Could you please tell me where am I going wrong.

First I tried running this piece of code in my controller under onInit() function but it threw an error in my manifest file in the title declaration part. Then I tried it again in my Component.js file and this time i set the model to my core and assigned it a name, still I'm faced with the same error.

Below is the code i used in Component.js file after validating my condition, and its corresponding path mentioned in manifest.json

	var oModel = new JSONModel({
				"title": title,
				"appTitle": appTitle,
				"appDescr": appDescr
			});
			sap.ui.getCore().setModel(oModel, "oModel");

Below is the code without setting the model to the core nor giving it any name, and its corresponding path mentioned in manifest.json

	var oModel = new JSONModel({
				"title": title,
				"appTitle": appTitle,
				"appDescr": appDescr
			});

Any guidance on how to make this code work is highly appreciated.

Thanks

Imtiaz N

Former Member
0 Kudos

Hi Tobias,

You have to change the name in LPD_CUST and that name will reflect on launchpad.

Thanks,

Swati