0

I'm using ExtJS 5.1.1

I'm trying to trigger a button click event or simply excute the event handler of this button.

View File:

    {xtype: 'button',
        itemId: 'searchBtn',
        listeners:{
            click: 'mainSearch'
        }
    }

Controller File:

specialKeySearch: function(event){
    if (event.getKey() == event.ENTER){
        // Trigger 'mainSearch' event handler or click event of button
    }
}

mainSearch: function(){
    alert("something");
}

I tried so many options, but none of them works. so please point out where the issue is. Below are some I have tried:

1.

document.getElementById('searchBtn').click();    

2.

 Ext.ComponentQuery.query('#searchBtn')[0].fireEvent('click', Ext.ComponentQuery.query('#searchBtn')[0]);

3.

parent.child('button[itemId=searchBtn]').fireEvent('click', parent.child('button[itemId=searchBtn]'));

Please tell how to trigger a button click event or simply excute the event handler of this button.

Thanks in advanced!

1

1 Answer 1

0

This is more of a JavaScript question than ExtJS. But try tempResult.data[tempKey]

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.