Results 1 to 2 of 2

Thread: Ext.form.FieldSet instructions - set position

  1. #1
    Sencha User murrah's Avatar
    Join Date
    Oct 2007
    Location
    Katoomba, Blue Mountains, west of Sydney, Australia
    Posts
    398
    Vote Rating
    15
      0  

    Default Ext.form.FieldSet instructions - set position

    Hi,

    I wanted to have the "Instructions" appear at the top of the fieldset rather than at the bottom. The config option for instructions is a string. Digging into the code I found that it was set up in the applyInstructions() method of the FieldSet and that the instructions are actually an Ext.Title component and that the position is determined by the "docked" property.

    So, this override allows you to pass Ext.Title config instead of just a string.

    PHP Code:
    Ext.override(Ext.form.FieldSet, {

        
    applyInstructions: function (instructions) {

            
    /* How it was:
            if (typeof instructions == 'string') {
                instructions = {title: instructions};
            }

            Ext.applyIf(instructions, {
                docked : this.initialConfig.instructionsPosition,
                baseCls: this.getBaseCls() + '-instructions'
            });
            */

            // My change:
            
    if (typeof instructions == 'string') {
                
    instructions = {
                    
    titleinstructions,
                    
    docked'bottom'
                
    };
            }

            
    Ext.applyIf(instructions, {
                
    baseClsthis.getBaseCls() + '-instructions'
            
    });



            return 
    Ext.factory(instructionsExt.Titlethis._instructions);
        }
    }); 
    Usage:
    PHP Code:
    {
        
    xtype'fieldset',
        
    title'Comments? Suggestions?',

        
    // Using just a string which will appear below the fieldset as per the docs 
        //instructions: 'Any issues using it? Would this be useful?<br>Who could benefit? Suggestions?',

        // Passing Ext.Title config instead:
        
    instructions: {
            
    title'Any issues using it? Would this be useful?<br>Who could benefit? Suggestions?',
            
    docked'top'
        
    },

        
    items: [{...}]

    Of course, docked can be top, bottom, left or right. See the Ext.Title for config options you now have available for FieldSet instructions (tpl, listeners, etc etc).

    Cheers,
    Murray

  2. #2
    Sencha - Support Team
    Join Date
    Oct 2011
    Posts
    4,094
    Vote Rating
    136
      0  

    Default

    Cool thanks for sharing!
    Get more personalized support via a support subscription.

    Need more help with your app? Hire Sencha Services services@sencha.com

    When posting code, please use BBCode's CODE tags.

    Need to include a test case use:
    The official Sencha Fiddle

Tags for this Thread

Posting Permissions

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