1. #1
    Ext JS Premium Member
    Join Date
    Dec 2011
    Posts
    227
    Vote Rating
    2
    nicolabaldo is on a distinguished road

      0  

    Default change button's order

    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,492
    Vote Rating
    283
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      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
    227
    Vote Rating
    2
    nicolabaldo is on a distinguished road

      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,492
    Vote Rating
    283
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      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
    227
    Vote Rating
    2
    nicolabaldo is on a distinguished road

      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
    25
    Vote Rating
    0
    jasewell is on a distinguished road

      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
    227
    Vote Rating
    2
    nicolabaldo is on a distinguished road

      0  

    Default


    It works!
    Thanks a lot.

  8. #8
    Sencha User
    Join Date
    Feb 2013
    Location
    Lawrence, KS, USA
    Posts
    25
    Vote Rating
    0
    jasewell is on a distinguished road

      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.

Thread Participants: 2