Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6660251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:07:55+00:00 2026-05-26T02:07:55+00:00

I have created an instance class from Ext.Component to use the ul tag. here

  • 0

I have created an instance class from Ext.Component to use the ul tag.
here the the demo
and this is how i use my contentMenu :

{
    xtype : "contentmenu"
    title : "Data Master",
    items : [{
        id : "action-siswa",
        iconCls : "icon-monitor",
        text : "Siswa",
        handler : function(){
            console.info("aaaa");
        }
    },{
        id : "action-sekolah",
        iconCls : "icon-monitor",
        text : "Sekolah",
        handler : function(){
            console.info("aaaa");
        }
    }]
}]

how to execute my handler ????
i want to execute my handler inside method doAction..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:07:56+00:00Added an answer on May 26, 2026 at 2:07 am

    Here is your situation your contentmenu widget creating their items as dom and their handler property can’t been seen as the items is deleted in the initComponent section.

    I know why you need to do this because you need a clean template render for panel item. So the solution for this problem is by using an explicit contentmenu items property that can’t be interference by rendering process in initComponent but can be accessed in doAction.

    See code bellow:

    Ext.onReady(function() {
    
        Ext.define("Ext.ux.ContentMenu", {
            extend: "Ext.panel.Panel",
            alias: "widget.contentmenu",
    
            tpl: new Ext.XTemplate('<tpl for=".">', '<li style="margin: 3px 3px 3px 3px;">', '<img src="', Ext.BLANK_IMAGE_URL, '" class="{iconCls}" style="height:16px;margin-bottom:2px;margin-right:7px;vertical-align:middle;width:16px;"/>', '<a id="{id}" href="#" style="color:#3764A0;font-size:11px;text-decoration:none;">{text}</a>', '</li>', '</tpl>'),
    
            initComponent: function() {
                var c = this;
                var items = c.items; //temp items var
                delete c.items;  //need to do this to get clean panel display
                c.data = items;
                this.callParent();
                c.menus = items; //items is stored as menus property for the contentmenu
            },
            afterRender: function() {
                var m = this;
                m.callParent();
                b = m.body;
                b.on('mousedown', this.doAction, this, {
                    delegate : "a",
                    preventDefault: true,
                    stopEvent: true
                });
            },
            doAction: function(a, b) {
                //Do the items handler
                Ext.each(this.menus, function(name, idx, arr) {
                    if(arr[idx].id === b.id) { //found matched menu items
                        arr[idx].handler(); //do the handler
                        return false; //break here
                    }
                });
            }
        });
    
        Ext.create("Ext.Window", {
            title: "aaa",
            width: 200,
            height: 150,
            layout: "fit",
            defaults: {
                xtype: "contentmenu"
            },
            items: [{
                title: "Data Master",
                items: [{
                    id: "action-siswa",
                    iconCls: "icon-monitor",
                    text: "Siswa",
                    handler: function() {
                        Ext.Msg.alert("Action Siswa","Handler action-siswa");
                    }},
                {
                    id: "action-sekolah",
                    iconCls: "icon-monitor",
                    text: "Sekolah",
                    handler: function() {
                        Ext.Msg.alert("Action Sekolah","Handler action-sekolah");
                    }
                }]
            }]
        }).show();
    });
    

    Maybe this help you

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Example: I have an class that inherits from UIImageView. An object creates an instance
I have created my custom MembershipProvider. I have used an instance of the class
I have created a class that returns a datatable, when I use the class
I have created an inherited class StorageMedium from a base I called DataTypes. StorageMedium
I have a class (simulation) which creates an instance of another class (GUI). Inside
I have a class Page that creates an instance of DB , which is
Using the client-side ASP.NET AJAX library, I have created an instance of a client
I have created a multi-instance performance counter and I pass it mixed case instance
I want to create an instance of an IronPython class from C#, but my
I have created a custom attribute that I am using on my class MyClass

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.