Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Occasional Contributor
Posts: 12
Registered: ‎08-23-2016

SDK : Modify Custom Toolbar button

[ Edited ]



Is there a way to get a cutom toolbar button and to change its properties, like the tooltip, the icon url etc.. ?


for example, I add a 'Hello World' button in the toolbar : 

var iconMoveUrl = "url 1"

$GP.ui.toolbar.add({ iconCls: 'x-btn-icon',
icon: iconMoveUrl,
xtype: "tbbutton", text: "Hello World!", handler: function (b) { $"Hello World!"); } });

then, while I'm using the Geoportal, I want to modify dynamically this button and change the icon  : 

iconMoveUrl = "url 2"


Can anyone help ?


Many thanks,


Technical Evangelist
Posts: 1,405
Registered: ‎09-11-2015

Re: SDK : Modify Custom Toolbar button

Hi David,


  1. Set button id parameter (e.g. id: 'my-new-button1')
  2. Use this parameter to find the button - var btn = Ext.getCmp('my-new-button1')
  3. Define the image in CSS and change the CSS - btn.setIconClass('class-name')

See the full ExtJS documentation here:!/api/Ext.Button




Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial