Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7897293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:07:47+00:00 2026-06-03T08:07:47+00:00

In ExtJS with control() method of Ext.app.Controller class I can add listeners to components

  • 0

In ExtJS with control() method of Ext.app.Controller class I can add listeners to components selected via Ext.ComponentQuery inside controller’s init() method.

Doing so by default I have the controller scope inside my handler functions. Is there a way to specify some other scope here?

For example in this case:

Ext.define('BackOffice.controller.BaseList', {
    extend: 'Ext.app.Controller',

    refs: [
        // some refs
    ],

    init: function() {
        this.control({
            'bo-list-view > toolbar > button[action=create-new]': {
                click: this.onCreateNewClick
            },

            'bo-list-view > toolbar > button[action=edit]': {
                click: this.onEditClick
            },

            'bo-list-view > toolbar > button[action=refresh]': {
                click: this.onRefreshClick
            }
        })
    },

    // ...
});

In handler functions I want to know the exact buttons clicked to perform some actions based on this information.

I’ve tried specifying scope within button declaration via scope field, this doesn’t help.

Also I wanted to use Ext.bind() to solve the issue, but to bind the function to I need some reference to the button again.

Using .on() to add listeners doesn’t work in init() because it’s called before application’s launch method.

Is there any way to add listeners to this buttons from controller saving the scope?

Update

The reference to the button is passed as the first argument into the handler function.
This solves my problem, but still looking for a way to define the scope inside control() method.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T08:07:49+00:00Added an answer on June 3, 2026 at 8:07 am

    If you look at description of the click event: http://docs.sencha.com/ext-js/4-0/#!/api/Ext.button.Button-event-click you will see that very first arguments will be pointer to the button, i.e. you don’t need to change the scope – just declare arguments in your function and you will know which button was pressed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I add custom properties into control objects in ExtJs. For example :
I have an MVC app in Extjs 4 which has a View (extending Ext.panel.Panel
I'm using a ExtJS DateField control in an ASP.NET MVC web application. I've set
One of the most appealing features of Ext-JS is the Grid control in my
ExtJS Charts, I am using an Ext column chart and I want to implement
I'm using ExtJS 2.2.1 In my web app, I used to have a TreePanel
I have a MVC app built with extJS 4. I want to disable a
I'm looking for advice/opinions on Javascript control libraries like ext-js, dhtmlx, jquery-UI etc... I've
In ExtJS version 3, there was a property grid in Ext.grid.RowSelectionModel and in version
My question is releated to Extjs 3.4 Slider control. I want to get values

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.