]> git.proxmox.com Git - proxmox-widget-toolkit.git/blob - src/button/AltText.js
Buttons: add AltText
[proxmox-widget-toolkit.git] / src / button / AltText.js
1 Ext.define('Proxmox.button.AltText', {
2 extend: 'Proxmox.button.Button',
3 xtype: 'proxmoxAltTextButton',
4
5 defaultText: "",
6 altText: "",
7
8 listeners: {
9 // HACK: calculate the max button width on first render to avoid toolbar glitches
10 render: function(button) {
11 let me = this;
12
13 button.setText(me.altText);
14 let altWidth = button.getSize().width;
15
16 button.setText(me.defaultText);
17 let defaultWidth = button.getSize().width;
18
19 button.setWidth(defaultWidth > altWidth ? defaultWidth : altWidth);
20 },
21 },
22 });