1. #1
    Sencha User
    Join Date
    Jul 2007
    Posts
    50
    Vote Rating
    0
    olakara is on a distinguished road

      0  

    Exclamation Answered: Disable / Enable a trigger in triggerfield

    Answered: Disable / Enable a trigger in triggerfield


    I have a trigger field as follows:

    Code:
    xtype: 'triggerfield',
    emptyText: 'click the trigger',
    trigger1Cls:'x-form-search-trigger',
    trigger2Cls:'x-form-view-trigger',
    allowBlank: false,
    onTrigger1Click : function() {
    	// action for search
    },
    onTrigger2Click : function() {
    	// action for dropdown
    }
    Now, in my form I have a condition where-in I need to disable the search trigger (trigger1Cls).. how do I disable the specific trigger alone and later enable it?

  2. Relative to a combo:

    var c = new Ext.form.field.ComboBox({
    renderTo : Ext.getBody(),
    store : ['blah','blah blah']
    });
    c.triggerEl.elements[0].addCls('x-item-disabled')

  3. #2
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,361
    Answers
    102
    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


    Relative to a combo:

    var c = new Ext.form.field.ComboBox({
    renderTo : Ext.getBody(),
    store : ['blah','blah blah']
    });
    c.triggerEl.elements[0].addCls('x-item-disabled')

  4. #3
    Sencha User
    Join Date
    Jul 2007
    Posts
    50
    Vote Rating
    0
    olakara is on a distinguished road

      0  

    Default


    That would just apply the CSS. Users will be able to still click and invoke the action method. I am looking for disabling the listener methods as well.
    Since, I didn't get any one shot solution, I am currently handling the functionality as:
    1. Add / Remove the "x-item-disabled" CSS class.
    2. Handle the execution of code at listener methods by look at the trigger's state.

    Any other way to handle this situation?
    Thanks and Regards,
    Abdel Olakara.
    [ blog : http://technopaper.blogspot.com ]

  5. #4
    Ext JS Premium Member tvanzoelen's Avatar
    Join Date
    Apr 2008
    Location
    Groningen - Netherlands
    Posts
    1,114
    Answers
    83
    Vote Rating
    30
    tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about tvanzoelen has a spectacular aura about

      0  

    Default


    You could do

    Code:
    this.triggerEl.elements[0].mask();
    and on click check if it is masked with

    Code:
    this.triggerEl.elements[0].isMasked();