Page 5 of 5 FirstFirst ... 345
Results 41 to 49 of 49

Thread: Ext.form.Button

  1. #41
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996
    Vote Rating
    8
      0  

    Default

    Quote Originally Posted by mschwartz View Post
    In any case, you may want to consider the code change I suggested to Ext.form.BasicForm in post #34 for a future release.
    @mschwartz
    Do you realize mystix is a volunteer? It's not like he has control over what goes into future releases. There's a feature request forum. Not sure that your post will garner much attention buried inside this thread.

  2. #42
    Ext User
    Join Date
    Mar 2008
    Location
    Julatten, QLD, Australia
    Posts
    10
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by Animal View Post
    Ach! The code to test for fieldLabel is in the 3.0 branch and not the 2.2 branch, so it won't work yet! That's a bit of a mismatch in modification procedure by Jack (or whoever authored that fix). The change should have gone into both branches.

    Oh well. I'll update the doc comments in the 3.0 branch.
    Not sure if this is the place to flag this... but it's still not in the 2.2.1 release.
    BTW, the isFormField property works fine in 2.2.1. Either it should be documented as a 2.2.x feature or fieldLabel needs to be fixed for 2.2.x

  3. #43
    Ext User
    Join Date
    Mar 2008
    Location
    Julatten, QLD, Australia
    Posts
    10
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by mystix View Post
    whoops. my mistake.

    you can avoid having to write the validate function on every Ext.Button config by overriding its prototype:
    Code:
    Ext.override(Ext.Button, {
        validate: function() {
            return true; // or some custom validation routine
        }
    });
    after which you don't need your check anymore.
    Note: Also need to override clearInvalid and getName with Ext.emptyFn for getForm().load to work....
    Code:
    Ext.override(Ext.Button, {
        validate: function() {
            return true; // or some custom validation routine
        }
        ,clearInvalid:Ext,.emptyFn
        ,getName:Ext.emptyFn
    });

  4. #44
    Ext User
    Join Date
    Mar 2008
    Posts
    57
    Vote Rating
    0
      0  

    Default

    Code:
    ButtonField = Ext.extend(Ext.form.Field,  {
    	defaultAutoCreate  : { 
    		tag: 'div' 
    	},
    	onRender: function (ct, position) {
                if(!this.el){
                    var cfg = this.getAutoCreate();
                    if(!cfg.name){
                        cfg.name = this.name || this.id;
                    }
                    if(this.inputType){
                        cfg.type = this.inputType;   
    		}
                    this.el = ct.createChild(cfg, position);
                }
    
    		this.button =  	new Ext.Button({
    			renderTo : this.el,
    			text     : this.text,
    			iconCls  : this.iconCls || null,
    			handler  : this.handler || Ext.emptyFn,
    			scope    : this.scope   || this
    		})
    	},
    	getValue : Ext.emptyFn,
    	setValue : Ext.emptyFn
    });

    This worked like a charm, example:

    Code:
    	,items: [
    		new ButtonField({
    			text: 'mybutton'
    		})
    	,{...}]
    Thank you jgarcia

  5. #45
    Ext User andreros's Avatar
    Join Date
    Jul 2008
    Location
    Leiria, Portugal
    Posts
    5
    Vote Rating
    0
      0  

    Default

    Hello all!

    I downloaded this component (thanks Radu094 for this good ideia) but after using it a little bit, I found a bug. When we disable the whole form, the button still fires the "onClick" event, even though it is disabled. For this issue I found the following solution:

    PHP Code:
    Ext.ux.FormButton Ext.extend(Ext.form.Field, {

        
    //private
        
    initComponent: function() {
            
    Ext.ux.FormButton.superclass.initComponent.call(this);
        },
        
        
    defaultAutoCreate: { 
            
    tag'div' 
        
    },

        
    onRender: function (ctposition) {
            
            if(!
    this.el){
                var 
    cfg this.getAutoCreate();
                if (!
    cfg.name) { cfg.name this.name || this.id; }
                if (
    this.inputType) { cfg.type this.inputType; }
                
    this.el ct.createChild(cfgposition);
                
    //Undefined dom value bug fix
                
    this.el.dom.value '';
            }

            
    this.button = new Ext.Button({
                
    renderTo this.el,
                
    text     this.text,
                
    iconCls  this.iconCls || null,
                
    tooltip  this.tooltip,
                
    minWidth this.minWidth,
                
    maxWidth this.maxWidth,
                
    handler  this.handler || Ext.emptyFn,
                
    action     this.handler || Ext.emptyFn,
                
    scope    this.scope
            
    });
            
        },
        
        
    onDisable: function() {
            
    Ext.ux.FormButton.superclass.onDisable.call(this);
            
    this.button.disable();
            
    this.button.scope this;
            
    this.button.handler Ext.emptyFn;
        },
        
        
    onEnable: function() {
            
    Ext.ux.FormButton.superclass.onEnable.call(this);
            
    this.button.enable();
            
    this.button.scope this;
            
    this.button.handler this.button.action;
        },

        
    resetExt.emptyFn,
        
        
    getValue Ext.emptyFn,
        
        
    setValue Ext.emptyFn
        
    }); 
    Hope you find this useful.

    Regards,
    Andr.
    Andr Rosa,
    ExtJS 2.3 / Javascript Enthusiast.

  6. #46
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    10
    Vote Rating
    0
      0  

    Default

    thanks a lot.

    i think Extjs should include Ext.form.Button in the future.

    this is a common requirement, isn't it?

    Ext.Button is not an <input> tag in html so this should be a standard component ...

    another issue is that we can not use it in Ext designer ...

    but that doesn't matter ...

  7. #47
    Sencha User
    Join Date
    Apr 2012
    Posts
    5
    Vote Rating
    0
      0  

    Default how to remove the default LabelSeparator(:)

    how to remove the default LabelSeparator(

  8. #48
    Sencha User
    Join Date
    Jun 2017
    Posts
    11
    Vote Rating
    0
      0  

    Default How to add this to program.i'm getting the error btn.addClass is not a function.

    How to add this this to program..i'm getting the error btn.addClass is not a function..i'm using ext js 4.2.3..
    Quote Originally Posted by Radu094 View Post
    I often got myself into a situation where I needed to add a button into a form.

    Next to all the checkboxes and text fields, it would have been so usefull to have a Ext.form.Button.

    Yes, I know you can addButton() to a form, but those go down to the bottom and I needed some of the buttons to "stay in context" and be rendered inside the fieldset.

    Anyway... long story short I've merged part of Ext.Button and Ext.form.Field into a new class.

    PHP Code:
    form.add
                    new 
    Ext.form.Button(
                    {
    fieldLabel:'Reset Password',
                     
    text:'Reset',
                     
    icon:'key.gif',
                     
    cls:'x-btn-text-icon',
                     
    handler:function(){alert('clicked');},
                     
    descriptionText:'click here to reset your password'
                     
    })); 

  9. #49
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Vote Rating
    291
      0  

    Default

    The code in this thread was created for Ext JS 2.x.

  10. #50
    Sencha User
    Join Date
    Jun 2017
    Posts
    11
    Vote Rating
    0
      0  

    Default

    oh do you've an equivalent or something similar in extjs 4.2.3

Page 5 of 5 FirstFirst ... 345

Posting Permissions

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