Skip to content

Instantly share code, notes, and snippets.

@savelee
Created November 1, 2016 11:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save savelee/6d65fb7b2c22dbd46de38f812750c024 to your computer and use it in GitHub Desktop.
Save savelee/6d65fb7b2c22dbd46de38f812750c024 to your computer and use it in GitHub Desktop.
Custom component (part 3)
Ext.define('ExtAddonHref.component.Href', {
extend: 'Ext.Component',
xtype: 'extaddonhref',
target: "_blank",
url: "",
title: "",
anchorName: "",
enableExternalUrlIcon: true,
preventDefault: false,
renderTpl: [
'<a class="hrefcomponent" href="{url}"',
'<tpl if="target"> target="{target}"</tpl>',
'<tpl if="enableExternalUrlIcon">rel="external"</tpl>',
'<tpl if="anchorName"> name="{anchorName}"</tpl>',
'>{title}</a>'
],
beforeRender: function () {
var me = this;
me.callParent();
Ext.applyIf(me.renderData, {
anchorName: me.anchorName,
url: me.url,
target: me.target,
title: me.title
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment