View Full Version : Can a controller action call a basic function?

24 Feb 2012, 5:49 AM

I have some combo's which I need to call a common basic function if the select or change events fires for any of these. At the moment they are calling specific select and change functions like so:

Ext.define('PPExtranet.controller.Customer', {
extend: 'Ext.app.Controller',

init: function() {

"#cmbCustomerFilter": {
select: this.onCmbCustomerFilterSelect,
change: this.onCmbCustomerFilterChange

var me = this;


onCmbCustomerFilterSelect: function(field, value, options) {
console.log('cmbCustomerFilterSelect cstName now: '+value[0].data.Name);


onCmbCustomerFilterChange: function(field, newValue, oldValue, options) {
console.log('cmbCustomerFilterChange cstName now: '+newValue);

filterCustomersStore: function() {



But I now want them to call a common basic function (i need to do some custom filtering on a store), however if I try and change the function name in Designer on my select and change controller actions, Designer wont let me saying that the function name is already in use or reserved.

Does this mean in the current select and change handler functions above, I then need to make a call to my basic function?

24 Feb 2012, 8:58 AM
You are correct in your assumptions.

In the above situation both onCmbCustomFilterSelect/onCmbCustomFilterChange should invoke filterCustomersStore. You can do this via this.filterCustomersStore();

We don't allow binding of a single function to multiple events because even though you can do it when using raw js it can be a source of bugs and frustration. As you can see above the arguments to the function are not the same. How do you know which one to use and where it came from, etc, etc.