1

I have a checkitem menu and I want to add icons to each menu item, so I inserted each icon after the menu item is rendered.

peace of my code:

{   xtype: 'menucheckitem',
     text: 'First Arrow'
     listeners: {
           render: {
                 fn: me.onMenucheckitemRender,
                 scope: me
                        }
                     }
}



onMenucheckitemRender: function (abstractcomponent, options)
{
Ext.DomHelper.insertAfter(abstractcomponent.getEl().down(".x-menu-item-icon"), {
    tag: 'img', 
    src: "icons/arrow1.png"
});
}

This works just fine, but since I will need it many times with different icons, I would like to know how to create a subclass so I can reuse this functionality.

Thank you

4

1 回答 1

0

使用Ext.define方法和extend属性。

Ext.define('SomeNamespace.menu.menucheckitemWithIcon', {
  extand: 'Ext.menu.CheckItem',
  alias: 'widget.menucheckitemWithIcon',

  .
  .
  . 

});
于 2012-09-11T20:49:29.663 回答