1. #1
    Sencha User
    Join Date
    Jul 2008
    Posts
    33
    Vote Rating
    0
    muratyildiz is on a distinguished road

      0  

    Default Custom FormPanel buttons event or method not a function.

    Custom FormPanel buttons event or method not a function.


    FireBug error:

    btns[i].setDisabled is not a function
    btns[i].setDisabled(true);


    Code:
    Ext.define('Jes.ux.FormPanel', {
        extend : 'Ext.form.FormPanel',
        requires: ['Jes.ux.Button'],
        alternateClassName : 'Jes.FormPanel',
        alias : 'widget.jform',
        method : null,
        hiddenStates : null,
        showStates : null,
        enableStates : null,
        disableStates : null,
        validation : false,
        border : true,
        bodyPadding : 10,
        url : null,
        initComponent : function() {
            Jes.ux.FormPanel.superclass.initComponent.apply(this, arguments);
        },// eo initComponent
        setState : function(method) {
            if (this.getForm().buttons) {
                var btns = this.getForm().buttons;
                Ext.each(btns, function(btn) {
                    if (Ext.isObject(btn)) {
                        btn.setDisabled(true);
                    }
                });
            }
        }
    });

  2. #2
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    try this.fbar.items.each(function(btn) { btn.disable() }));

    I have not tested this with ext 4, but it's along the correct lines.

  3. #3
    Sencha User
    Join Date
    Jul 2008
    Posts
    33
    Vote Rating
    0
    muratyildiz is on a distinguished road

      0  

    Default


    That code did not work

    The sample code that does not work
    Code:
    .......................
                ,buttons:[                 {text:'Save',xtype:'jbutton',onSuccess:function(form,action)
    {panel1.setState('giris');panel1.disableFields(true);},method:'kaydet'},
    {disableStates:'giris',text:'Delete',xtype:'jbutton',onSuccess:function(form,action){alert('silindi');},method:'sil',enableStates:'edit'}                 ,
    {onClick:function(){this.up('jform').getForm().reset();panel1.disableButtons(false);panel1.setState('kaydet','last');},disableStates:'kaydet',text:'Cancel',xtype:'jbutton',enableStates:'edit'}             ] ........................
    but this works

    Code:
    ,buttons:[                 
    Ext.create('Jes.ux.Button',{text:'Save',xtype:'jbutton',onSuccess:function(form,action){panel1.setState('giris');panel1.disableFields(true);},method:'kaydet'})                 ,
    Ext.create('Jes.ux.Button',{disableStates:'giris',text:'Delete',xtype:'jbutton',onSuccess:function(form,action){alert('silindi');},method:'sil',enableStates:'edit'})                 ,
    Ext.create('Jes.ux.Button',{onClick:function(){this.up('jform').getForm().reset();panel1.disableButtons(false);panel1.setState('kaydet','last');},disableStates:'kaydet',text:'Cancel',xtype:'jbutton',enableStates:'edit'})             ]
    I changed the code as follows:

    Code:
    ...............
        setState : function(m, fld) {
            if (this.getForm().buttons) {
                var btns = this.getForm().buttons;
                Ext.each(btns, function(btn) {
                    btn.changeState(m);//custom buttons method.
                });
            }
            if (fld) {
                this.findField(fld).focus(true, 100);
            }
        }// eo setState
    ............
    problem is solved. thanks

Similar Threads

  1. extend class with custom method help
    By edmeehan in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 30 Sep 2010, 10:06 PM
  2. is formpanel's 'render' method necessary after 'add' method??
    By BlazeCrystal in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 22 Oct 2008, 1:40 AM
  3. Custom Buttons
    By origin in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 11 Dec 2007, 10:08 PM
  4. Custom Ext.util.Format method
    By josh in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 15 Oct 2007, 6:06 AM
  5. Replies: 6
    Last Post: 23 Jun 2007, 5:00 AM

Thread Participants: 1