How to change a widget title at runtime

1895
4
Jump to solution
12-02-2016 02:17 PM
GregRieck
Occasional Contributor III

Hello,

Does anyone know how to change the title of a widget dynamically at runtime? I would like to prepend additional information after the existing title. For example if my widget title is "ABC" I would like to prepend "ABC: 123".

Thank You

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Greg,

   So if you want to change the widgets title from inside the widgets code you would use:

this.getPanel().titleLabelNode.innerHTML = "blah blah";

View solution in original post

4 Replies
RobertScheitlin__GISP
MVP Emeritus

Greg,

   This is thread is not for changing the widget title but the same exact principle applies:

https://community.esri.com/thread/170015 

0 Kudos
GregRieck
Occasional Contributor III

Robert,

Thank you for responding. Yeah, that's not it. That changes the title of the title bar of the application. What I'm looking for is to change the title of the "widget" at runtime. Inside the widget path /nls/string.js I have the below. I am wanting to change the widgetTitle to My Widget: "SOME ADDITIONAL TEXT"

define({
root: {
widgetTitle: 'My Widget',
_featureAction_MyWidget: "My Widget",
description: 'A custom widget.'
}
// add supported locales below:
// , "zh-cn": true
});

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Greg,

  Yes, I guess you missed the part where I said the concept would be the same. You just have to do the proper query for the widgets title.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Greg,

   So if you want to change the widgets title from inside the widgets code you would use:

this.getPanel().titleLabelNode.innerHTML = "blah blah";