Results 1 to 2 of 2

Thread: Extending panel

  1. #1

    Default Extending panel

    I need to extend a panel with resizable property. This is what i did so far
    Code:
    Ext.override(Ext.Panel, {
                            // private
                            initEvents: function () {
    
                                if (this.draggable) {
                                    this.initDraggable();
                                }
                                this.resizer = new Ext.Resizable(this.el, {
                                    animate: true,
                                    duration: '.6',
                                    easing: 'backIn',
                                    handles: 'all',
                                    pinned: false,
                                    transparent: true
                                });
                                this.resizer.on("resize", this.onResizer, this);
                            },
                            onResizer: function (oResizable, iWidth, iHeight, e) {
                                this.setHeight(iHeight);
                                this.setWidth(iWidth);
                            }
                        });
    code for creating panel
    Code:
    var childPanel = new Ext.Panel({
                            draggable: true,
                            layout: 'fit',
    
    ................
    });
    As you can see i am overriding the property. therefore all the panels that i create have these properties. I dont want like that. I need to extend the panel rather than overriding it. Can anybody extend the default behaviour of panel with the above code and paste it here?

  2. #2
    Sencha User
    Join Date
    Oct 2009
    Location
    Cambridge, UK
    Posts
    164

    Default

    Use Ext.extend to extend classes!
    Code:
    Acme.ResizePanel = Ext.extend(Ext.Panel, {
      initEvents: function() {
        ...
      }
    }
    
    var childPanel = new Acme.ResizePanel({...});

Posting Permissions

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