lundi 13 octobre 2014

Creating link tool

I created panel tool that show url link instead of icons. Source code:

Code:



Ext.define('MVC.view.LinkTool', {
extend: 'Ext.panel.Tool',
alias: 'widget.linktool',

redirectCurrent: false,

renderTpl: ['<a class="{baseCls}-{type} {specificCls}" style="color: rgb(0,255,0); font-size: 12px; line-height: 15px" role="link" href="{link}">{caption}</a>'],


initComponent: function(){
Ext.applyIf(this.renderData, {
link: this.link,
caption: this.caption
});

this.callParent();
},

handler: function(){
if(this.redirectCurrent){
window.location = this.link;
} else {
var windowReference = window.open(this.link, this.caption);
if(windowReference){
windowReference.focus();
}
}
}
});

When I use this tool in one panel, everything works fine. But when I try use tool in two panels, second is not rendered correct. Parameter left in second link tool is counted from width of first link tool. It means, when i change caption in first link tool, it changes left parameter of second link tool. Here is screenshot from application:

linkpanel.jpg


Anyone can help, how to fix it (without setting width parameter)? Here is fiddle example: http://ift.tt/1sFYh2i






Creating link tool

Aucun commentaire:

Enregistrer un commentaire