Results 1 to 8 of 8

Thread: change button's order

  1. #1
    Ext JS Premium Member
    Join Date
    Dec 2011
    Posts
    232
    Vote Rating
    2
      0  

    Default change button's order

    I use ExtJS 4.1.3
    Is it possible to insert the tool '+' before of the tool collapse??
    Thanks!
    Immagine.png

  2. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,790
    Vote Rating
    391
      0  

    Default

    I think collapseFirst should do what you want:

    http://docs.sencha.com/ext-js/4-1/#!...-collapseFirst

  3. #3
    Ext JS Premium Member
    Join Date
    Dec 2011
    Posts
    232
    Vote Rating
    2
      0  

    Default

    Tanks for reply me.
    I tried to use collapseFirst: false, but it doesn't work!

    Code:
    Ext.define('Ext.cbaPortlet.Portlet', {
        extend: 'Ext.panel.Panel',
        alias: 'widget.portlet',
        layout: 'fit',
        anchor: '100%',
        frame: true,
        closable: false,
        collapseFirst: false,
        collapsible: true,
        animCollapse: true,
        draggable: {
            moveOnDrag: false    
        },
        cls: 'x-portlet',
    
    
        // Override Panel's default doClose to provide a custom fade out effect
        // when a portlet is removed from the portal
        doClose: function() {
            if (!this.closing) {
                this.closing = true;
                this.el.animate({
                    opacity: 0,
                    callback: function(){
                        this.fireEvent('close', this);
                        this[this.closeAction]();
                    },
                    scope: this
                });
            }
        }
    });
    Last edited by skirtle; 21 Dec 2012 at 8:32 AM. Reason: Add CODE tags

  4. #4
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,790
    Vote Rating
    391
      0  

    Default

    Please use [CODE] tags when posting code.

    I don't see anywhere in your code that's adding a + tool.

  5. #5
    Ext JS Premium Member
    Join Date
    Dec 2011
    Posts
    232
    Vote Rating
    2
      0  

    Default

    I'm sorry!! I forgot this part.

    Code:
    var x=Ext.getCmp('myPortlet').down(); //panel header
    if (!x.tools.plus){
      x.addTool({
        type:'plus',		
        handler: function(){
        myFunction();
        }
      },	
        scope:this
      });

  6. #6
    Sencha User
    Join Date
    Feb 2013
    Location
    Lawrence, KS, USA
    Posts
    28
    Vote Rating
    0
      0  

    Default

    Try this:
    Code:
    var x=Ext.getCmp('myPortlet').down(); //panel header
    if (!x.tools.plus){
      x.insert(0, {
        type:'plus',		
        handler: function(){
        myFunction();
        }
      },	
        scope:this
      });

  7. #7
    Ext JS Premium Member
    Join Date
    Dec 2011
    Posts
    232
    Vote Rating
    2
      0  

    Default

    It works!
    Thanks a lot.

  8. #8
    Sencha User
    Join Date
    Feb 2013
    Location
    Lawrence, KS, USA
    Posts
    28
    Vote Rating
    0
      0  

    Default

    Great!
    I hope it's not belaboring the obvious to point out that the reason collapseFirst didn't do what you needed was that the tool was being added after the panel was created.

Posting Permissions

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