-
- // private
- onRender : function(container, position){
- if (!this.itemTpl) {
- this.itemTpl = Ext.menu.Item.prototype.itemTpl = new Ext.XTemplate(
- '<a id="{id}" class="{cls}" hidefocus="true" unselectable="on" href="{href}"',
- '<tpl if="hrefTarget">',
- ' target="{hrefTarget}"',
- '</tpl>',
- '>',
- '<img alt="{altText}" src="{icon}" class="x-menu-item-icon {iconCls}"/>',
- '<span class="x-menu-item-text">{text}</span>',
- '</a>'
- );
- }
- var a = this.getTemplateArgs();
- this.el = position ? this.itemTpl.insertBefore(position, a, true) : this.itemTpl.append(container, a, true);
- this.iconEl = this.el.child('img.x-menu-item-icon');
- this.textEl = this.el.child('.x-menu-item-text');
- if(!this.href) { // if no link defined, prevent the default anchor event
- this.mon(this.el, 'click', Ext.emptyFn, null, { preventDefault: true });
- }
- Ext.menu.Item.superclass.onRender.call(this, container, position);
- },
-
- getTemplateArgs: function() {
- return {
- id: this.id,
- cls: this.itemCls + (this.menu ? ' x-menu-item-arrow' : '') + (this.cls ? ' ' + this.cls : ''),
- href: this.href || '#',
- hrefTarget: this.hrefTarget,
- icon: this.icon || Ext.BLANK_IMAGE_URL,
- iconCls: this.iconCls || '',
- text: this.itemText||this.text||' ',
- altText: this.altText || ''
- };