WebGIS Discussions

Need a push in the right direction when configuring WebMap, Portal or SDI services? Looking for hints and tips, or just looking for Ideas and information? The WebGIS discussion board is where you start those discussions, connect and share information.
Showing results for 
Search instead for 
Do you mean 
Reply
Occasional Contributor
Posts: 12
Registered: ‎08-23-2016

SDK : Modify Custom Toolbar button

[ Edited ]

Hi,

 

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) { $GP.ui.info("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,

David

Technical Evangelist
Posts: 1,420
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: http://docs.sencha.com/extjs/2.3.0/#!/api/Ext.Button

 

Regards,

Jan

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial