1. #1
    Sencha User
    Join Date
    May 2010
    Posts
    7
    Vote Rating
    2
    eldono is on a distinguished road

      2  

    Default Top Button on bottom of FieldSet

    Top Button on bottom of FieldSet


    Hi!
    Don't know if it's been already posted, but here is a quick&dirty way to add a "Top" button on the bottom-right of a fieldset, which scrolls the page to the top (of course you can change the behaviour).

    Code:
    Ext.override(Ext.form.FieldSet, {
       createLegendCt : function() {
         var legend = this.callParent();
         if (this.showTopButton){
           legend.items.push(this.createTopButton());
         }
         return legend;
       },
       createTopButton : function() {
         var me = this;
         this.topButton = Ext.widget({
           xtype : 'tool',
           type : 'up',
           handler : function() {
             scroll(0, 0);
           },
           id : me.id + '-legendTop',
           scope : me
         });
         this.topButtonCt = Ext.widget({
           xtype: 'container',
           layout: 'hbox',
           hidden: !!this.collapsed,
           width: 46,
           style: {
             position: 'absolute',
             right: 10,
             bottom: -7,
             background: 'white',
             padding: '0px 3px 0px 3px'
           },
           items: [this.topButton, {
             xtype: 'box',
             html: 'Top',
             width: 20
           }]
         });
         this.addListener('collapse', function(){
           this.topButtonCt.hide();
         }, this);
         this.addListener('expand', function(){
           this.topButtonCt.show();
         }, this);
         
         return this.topButtonCt;
       }
     });
    Usage:
    Code:
    {
     xtype: 'fieldset',
     items: [...]
     showTopButton : true
     ...
    }
    Hope it helps.
    Attached Images

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,883
    Vote Rating
    440
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    Thanks for the tip. Someone may find it helpful.

    Scott.

  3. #3
    Sencha User talha06's Avatar
    Join Date
    Jul 2009
    Location
    Turkey
    Posts
    303
    Vote Rating
    0
    talha06 is on a distinguished road

      0  

    Default


    thanks for sharing, great idea for advanced field sets..
    "People will never forget how you made them feel."
    linkedin.com/in/talhakabakus

Thread Participants: 2

Tags for this Thread