on 05-22-2017 7:58 AM
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
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}"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
Hi Tobias,
You have to change the name in LPD_CUST and that name will reflect on launchpad.
Thanks,
Swati
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.