Results 1 to 4 of 4

Thread: ?????????????

  1. #1
    Sencha Premium Member Kazuhiro Kotsutsumi's Avatar
    Join Date
    Sep 2007
    Location
    Japan
    Posts
    82
    Vote Rating
    1
      0  

    Default ?????????????

    ???????????????????????Ext.menu.Menuk?????????????????

    ??Ext.menu.Menu?????????????????????????????
    ?????contextmenu??????????????

    ???????????????????????????????????????????????????????????????????????????????????????????????

    ?????????????????
    ?????2.2.1????
    ?????Right Click Cancel Menu?????
    ?????????????????????contextmenu???????????????????
    ??????????????????????????


    RCCMenu.js

    Code:
    /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
    
    // {{{ Ext.ux.override.RCCMenu
    
    /**
     * Ext.ux.override.RCCMenu
     *
     * ??????????????
     *
     * @author  Kazuhiro Kotsutsumi <kotsutsumi@xenophy.com>
     */
    if( Ext.version === '2.2.1' ) {
    
        Ext.override( Ext.menu.Menu, {
    
            // private
            render : function(){
    
                if(this.el){
                    return;
                }
                var el = this.el = this.createEl();
    
                if(!this.keyNav){
                    this.keyNav = new Ext.menu.MenuNav(this);
                }
                if(this.plain){
                    el.addClass("x-menu-plain");
                }
                if(this.cls){
                    el.addClass(this.cls);
                }
                // generic focus element
                this.focusEl = el.createChild({
                    tag: "a", cls: "x-menu-focus", href: "#", onclick: "return false;", tabIndex:"-1"
                });
                var ul = el.createChild({tag: "ul", cls: "x-menu-list"});
                ul.on("click", this.onClick, this);
                ul.on("mouseover", this.onMouseOver, this);
                ul.on("mouseout", this.onMouseOut, this);
    
                // ????????????
                ul.on("contextmenu", function( e, t ) {
    
                    if( this.fireEvent("contextmenu", this, e, t) ) {
                        e.stopEvent();
                    }
    
                }, this);
    
                this.items.each(function(item){
                    var li = document.createElement("li");
                    li.className = "x-menu-list-item";
                    ul.dom.appendChild(li);
                    item.render(li, this);
                }, this);
                this.ul = ul;
                this.autoWidth();
            }
    
            // }}}
    
        });
    
    }
    
    /*
     * Local variables:
     * tab-width: 4
     * c-basic-offset: 4
     * c-hanging-comment-ender-p: nil
     * End:
     */

  2. #2
    Sencha - Support Team yuki's Avatar
    Join Date
    Jun 2007
    Location
    Chigasaki, Japan
    Posts
    273
    Vote Rating
    0
      0  

    Default ??????

    ?????this.ul???????????????????????????
    Ext Japan, LLC [Twitter: @extjapan]
    [Ext JS / Ext GWT????????][????????????][Ext JS???????????????]

  3. #3
    Sencha Premium Member Kazuhiro Kotsutsumi's Avatar
    Join Date
    Sep 2007
    Location
    Japan
    Posts
    82
    Vote Rating
    1
      0  

    Default ??????

    Quote Originally Posted by yuki View Post
    ?????this.ul???????????????????????????
    ?????????????
    mon??????????????

  4. #4
    Sencha Premium Member Kazuhiro Kotsutsumi's Avatar
    Join Date
    Sep 2007
    Location
    Japan
    Posts
    82
    Vote Rating
    1
      0  

    Default Ext JS 3.0???

    render??onRender????????mon???????????????

    Code:
    /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
    
    // {{{ Ext.ux.override.RCCMenu
    
    /**
     * Ext.ux.override.RCCMenu
     *
     * ??????????????
     *
     * @author  Kazuhiro Kotsutsumi <kotsutsumi@xenophy.com>
     */
    if( Ext.version === '2.2.1' ) {
    
        Ext.override( Ext.menu.Menu, {
    
            // private
            render : function(){
    
                if(this.el){
                    return;
                }
                var el = this.el = this.createEl();
    
                if(!this.keyNav){
                    this.keyNav = new Ext.menu.MenuNav(this);
                }
                if(this.plain){
                    el.addClass("x-menu-plain");
                }
                if(this.cls){
                    el.addClass(this.cls);
                }
                // generic focus element
                this.focusEl = el.createChild({
                    tag: "a", cls: "x-menu-focus", href: "#", onclick: "return false;", tabIndex:"-1"
                });
                var ul = el.createChild({tag: "ul", cls: "x-menu-list"});
                ul.on("click", this.onClick, this);
                ul.on("mouseover", this.onMouseOver, this);
                ul.on("mouseout", this.onMouseOut, this);
    
                // ????????????
                ul.on("contextmenu", function( e, t ) {
    
                    if( this.fireEvent("contextmenu", this, e, t) ) {
                        e.stopEvent();
                    }
    
                }, this);
    
                this.items.each(function(item){
                    var li = document.createElement("li");
                    li.className = "x-menu-list-item";
                    ul.dom.appendChild(li);
                    item.render(li, this);
                }, this);
                this.ul = ul;
                this.autoWidth();
            }
    
            // }}}
    
        });
    
    } else if( Ext.version === '3.0' ) {
    
        Ext.override( Ext.menu.Menu, {
    
            // private
            onRender : function(ct, position){
                if(!ct){ 
                    ct = Ext.getBody();
                }
    
                var dh = {
                    id: this.getId(),
                    cls: 'x-menu ' + ((this.floating) ? 'x-layer ' : '') + (this.cls || '') + (this.plain ? ' x-menu-plain' : '') + (this.showSeparator ? '' : ' x-menu-nosep'),
                    style: this.style,
                    cn: [
                        {tag: 'a', cls: 'x-menu-focus', href: '#', onclick: 'return false;', tabIndex: '-1'},
                        {tag: 'ul', cls: 'x-menu-list'}
                    ]
                };
                if(this.floating){
                    this.el = new Ext.Layer({
                        shadow: this.shadow,
                        dh: dh,
                        constrain: false,
                        parentEl: ct,
                        zindex:15000
                    });
                }else{
                    this.el = ct.createChild(dh);
                }
                Ext.menu.Menu.superclass.onRender.call(this, ct, position);
    
                if(!this.keyNav){
                    this.keyNav = new Ext.menu.MenuNav(this);
                }
                // generic focus element
                this.focusEl = this.el.child('a.x-menu-focus');
                this.ul = this.el.child('ul.x-menu-list');
                this.mon(this.ul, 'click', this.onClick, this);
                this.mon(this.ul, 'mouseover', this.onMouseOver, this);
                this.mon(this.ul, 'mouseout', this.onMouseOut, this);
    
                // ????????????
                this.mon(this.ul, 'contextmenu', function( e, t ) {
    
                    if( this.fireEvent("contextmenu", this, e, t) ) {
                        e.stopEvent();
                    }
    
                }, this);
    
                if(this.enableScrolling){
                    this.mon(this.el, 'click', this.onScroll, this, {delegate: '.x-menu-scroller'});
                    this.mon(this.el, 'mouseover', this.deactivateActive, this, {delegate: '.x-menu-scroller'});
                }
            },
        });
    
    }
    
    /*
     * Local variables:
     * tab-width: 4
     * c-basic-offset: 4
     * c-hanging-comment-ender-p: nil
     * End:
     */

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •