fix bug in Sonia.util.Link

This commit is contained in:
Sebastian Sdorra
2011-06-15 08:56:16 +02:00
parent b7cfe3a14b
commit 7f2bcacead
3 changed files with 18 additions and 28 deletions

View File

@@ -31,27 +31,25 @@
Sonia.util.Link = Ext.extend(Ext.BoxComponent, {
handler: null,
scope: null,
constructor: function(config) {
config = config || {};
config.xtype = 'box';
config.autoEl = { tag: 'a', html: config.text, href: '#' };
Sonia.util.Link.superclass.constructor.apply(this, arguments);
this.addEvents({
'click': true,
'mouseover': true,
'blur': true
});
this.text = config.text;
},
onRender: function() {
theLnk = this;
this.constructor.superclass.onRender.apply(this, arguments);
if (!theLnk.disabled) {
this.el.on('blur', function(e) { theLnk.fireEvent('blur'); });
this.el.on('click', function(e) { theLnk.fireEvent('click'); });
this.el.on('mouseover', function(e) { theLnk.fireEvent('mouseover'); });
config.listeners = {
render: function(c) {
c.getEl().on('click', function(){
if (this.handler){
this.scope ? this.handler.call(this.scope) : this.handler();
}
}, this);
}
}
Sonia.util.Link.superclass.constructor.apply(this, arguments);
this.text = config.text;
}
});