कि जिस तरह से यह किया है ... अधिक पोर्टेबल आप Ext.ux.LinkButton
में Ext.Button
(या जो भी) का विस्तार कर सकता है और संपत्ति और इस विस्तारित वर्ग में आवश्यक व्यवहार (सिर्फ एक quick- & -dirty उदाहरण) को लागू होने के लिए:
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"
});
संपादित करें:
उपस्थिति के सरल परिवर्तन:
Ext.ux.LinkButton = Ext.extend(Ext.Button, {
href: null,
template: new Ext.Template(
['<table id="{4}" cellspacing="0" class="x-btn {3}"><tbody class="{1}">',
'<tr><td class="x-btn-tl"><i> </i></td><td class="x-btn-tc"></td><td class="x-btn-tr"><i> </i></td></tr>',
'<tr><td class="x-btn-ml"><i> </i></td><td class="x-btn-mc"><em class="{2}" unselectable="on"><a href="{0}"></a></em></td><td class="x-btn-mr"><i> </i></td></tr>',
'<tr><td class="x-btn-bl"><i> </i></td><td class="x-btn-bc"></td><td class="x-btn-br"><i> </i></td></tr>',
'</tbody></table>'], {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;
}
}
});
स्रोत
2010-12-28 08:29:25
जहां तक मुझे पता है, वैसे ही यह वास्तव में किया जाना चाहिए। – Mchl
ExtJS आधुनिक 6.x (6.5) के लिए https://stackoverflow.com/questions/47494458/extjs-6-x-modern-button-as-a-link/47519792#47519792 –