Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>That's the way it's done... To be more portable you could extend <code>Ext.Button</code> into <code>Ext.ux.LinkButton</code> (or whatever) and implement the property and the required behavior in this extended class (just a quick-&amp;-dirty example):</p> <pre><code>Ext.ux.LinkButton = Ext.extend(Ext.Button, { href: null, handler: function() { if (this.href) { window.location.href = this.href; } } }); Ext.reg( "ux-linkbutton", Ext.ux.LinkButton ); var btn = new Ext.ux.LinkButton({ text: "Link to Google", href: "http://www.google.com" }); </code></pre> <p><strong>EDIT:</strong></p> <p>Simple change of appearance:</p> <pre><code>Ext.ux.LinkButton = Ext.extend(Ext.Button, { href: null, template: new Ext.Template( ['&lt;table id="{4}" cellspacing="0" class="x-btn {3}"&gt;&lt;tbody class="{1}"&gt;', '&lt;tr&gt;&lt;td class="x-btn-tl"&gt;&lt;i&gt;&amp;#160;&lt;/i&gt;&lt;/td&gt;&lt;td class="x-btn-tc"&gt;&lt;/td&gt;&lt;td class="x-btn-tr"&gt;&lt;i&gt;&amp;#160;&lt;/i&gt;&lt;/td&gt;&lt;/tr&gt;', '&lt;tr&gt;&lt;td class="x-btn-ml"&gt;&lt;i&gt;&amp;#160;&lt;/i&gt;&lt;/td&gt;&lt;td class="x-btn-mc"&gt;&lt;em class="{2}" unselectable="on"&gt;&lt;a href="{0}"&gt;&lt;/a&gt;&lt;/em&gt;&lt;/td&gt;&lt;td class="x-btn-mr"&gt;&lt;i&gt;&amp;#160;&lt;/i&gt;&lt;/td&gt;&lt;/tr&gt;', '&lt;tr&gt;&lt;td class="x-btn-bl"&gt;&lt;i&gt;&amp;#160;&lt;/i&gt;&lt;/td&gt;&lt;td class="x-btn-bc"&gt;&lt;/td&gt;&lt;td class="x-btn-br"&gt;&lt;i&gt;&amp;#160;&lt;/i&gt;&lt;/td&gt;&lt;/tr&gt;', '&lt;/tbody&gt;&lt;/table&gt;'], {compiled: true}), buttonSelector : 'a:first-child', getTemplateArgs : function(){ return [this.href, 'x-btn-' + this.scale + ' x-btn-icon-' + this.scale + '-' + this.iconAlign, this.getMenuClass(), this.cls, this.id]; }, handler: function(b, e) { if (this.href) { e.stopEvent(); window.location.href = this.href; } } }); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload