But perhaps someone can help me with the LinkButton. It doesn't work for me:
Code:
Ext.define('IGP_Office.view.LinkCSVButton', {
extend: 'Ext.button.Button',
alias: 'widget.linkCSVButton',
icon: 'resources/icons/csv.png',
text: 'CSV export',
initComponent: function() {
var me = this;
Ext.applyIf(me, {
listeners: {
click: {
fn: me.onButtonClick,
scope: me
},
render: {
fn: me.onButtonRender,
scope: me
}
}
});
me.processLinkCSVButton(me);
me.callParent(arguments);
},
processLinkCSVButton: function(config) {
config.template = new Ext.Template(
'<table border="0" cellpadding="0" cellspacing="0" class="x-btn-wrap"><tbody><tr>',
'<td class="x-btn-left"><i> </i></td><td class="x-btn-center"><a class="x-btn-text" href="{1}" target="{2}">{0}</a></td><td class="x-btn-right"><i> </i></td>',
'</tr></tbody></table>');
return config;
},
onButtonClick: function(button, e, eOpts) {
if (e.button != 0) {
return;
}
if (!this.disabled) {
this.fireEvent("click", this, e);
if (this.handler) {
this.handler.call(this.scope || this, this, e);
}
}
},
onButtonRender: function(component, eOpts) {
var btn, targs = [this.text || ' ', this.href, this.target || "_self"];
if (eOpts) {
btn = this.template.insertBefore(eOpts, targs, true);
} else {
btn = this.template.append(component, targs, true);
}
var btnEl = btn.child("a:first");
btnEl.on('focus', this.onFocus, this);
btnEl.on('blur', this.onBlur, this);
this.initButtonEl(btn, btnEl);
Ext.ButtonToggleMgr.register(this);
}
});
The line
Code:
btn = this.template.insertBefore(...
throws an error, because this.template is undefined.
Thanks a lot.
Tobias