Results 1 to 2 of 2

Thread: Event handler for HTML button

  1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    221
    Answers
    10

    Default Event handler for HTML button

    HI All,

    I am using ExtJs 4.1. I have a view which contains a button and a tab panel. The tab panel have two tabs. On click of button, I load the data into one of the tab. While data is loading into the tab, I am showing mask over the tab using tab.setLoading().

    Code:
    Ext.define('MyProject.DefaultController',
    {
        id: 'DefaultController',
        extend: 'Ext.app.Controller',
       
        init: function () {
            this.control({
                'defaultview #btn-getData': {
                    click: this.onBtnData
                }
            });
        },
        onBtnData: function () {
          var tab = Ext.getCmp("my-tab");
          tab.getEl().mask('<input type="button"   value="Cancel" />');
            tab.setLoading('');
        }
    });

    I am showing a bttuon in the mask using tab.getEl().mask('<input type="button" value="Cancel" />');

    I want to add a event handler function for the cancel button in the mask. So when user clicks on the cancel button, system should call the required function.

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,448
    Answers
    3997

    Default

    Controllers can only listen for component events not element events. You will need to listen to it in the view
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

Posting Permissions

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