Skip to Content
0

Dynamic App Title for Fiori Apps

May 22, 2017 at 06:58 AM

545

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Akhilesh Upadhyay Jun 06, 2017 at 08:46 AM
1

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}" 
Show 1 Share
10 |10000 characters needed characters left characters exceeded

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");

path with model name

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
			});

path without model name

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

Thanks

Imtiaz N

0
avatar image
Former Member Jun 05, 2017 at 08:50 AM
0

Hi Tobias,

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

Thanks,

Swati

Share
10 |10000 characters needed characters left characters exceeded