1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    4
    Vote Rating
    0
    newsam is on a distinguished road

      0  

    Default disbale button based on condition

    disbale button based on condition


    Hi all,
    I am trying to disbale button based on some condition. I tried following thing

    Code:
    var simplePanel = new Ext.form.FormPanel({ 
            standardSubmit: true,  
            frame:true,
            width: 350,
            defaults: {width: 230},
     items: [ {
                    handler :  function(b, e) {
                        alert("hello");
                    },
                    disabled : function(button) {
                        //Some condition.
                       // return true or false
                    },
                    scope: this,
                    text: 'Button1',
                    width: 70,
                    xtype: 'button'
                }]
        });
    In above case my button always remains disabled irrespective of function disabled returns true or false.
    I dont was to set the button externally(form some other location).
    I know that there is no support disabled : function mentioned in documentation. but just tried.

    Is there any way by which this can be achieved ?

  2. #2
    Sencha User
    Join Date
    Oct 2009
    Location
    Cambridge, UK
    Posts
    164
    Vote Rating
    0
    Uberdude is on a distinguished road

      0  

    Default


    As you have noted, the disabled config option cannot be a function, it is a boolean. The setDisabled method needs to be called when you want to change the disabled status of the button. You would typically do this in an event listener for whatever event causes the disabled status to change. There is also the monitorValid property of a FormPanel, which coupled with formBind: true on the buttons means this event listener and calling of setDisabled happens 'by magic' within Ext.

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar