I have:
Code:
Ext.define('Desktop.ClientWindow', {
extend: 'Ext.ux.desktop.Module',
requires: [
'Ext.data.ArrayStore',
'Ext.util.Format',
'Ext.grid.Panel',
'Ext.grid.RowNumberer',
'Destktop.store.Client',
'Desktop.controller.ClientWindow' // <------------
],
id:'client-win',
init : function(){
this.launcher = {
text: 'Grid Window',
iconCls:'icon-grid'
};
},
createWindow : function(){
var desktop = this.app.getDesktop();
var win = desktop.getWindow('client-win');
if(!win){
win = desktop.createWindow({
id: 'client-win',
title:'Client Window',
width:740,
height:480,
iconCls: 'icon-grid',
animCollapse:false,
constrainHeader:true,
layout: 'fit',
items: [
{
border: false,
xtype: 'grid',
store: {
type: 'Client'
},
columns: [
new Ext.grid.RowNumberer(),
{
text: "IP",
flex: 1,
sortable: true,
dataIndex: 'id'
},
{
text: "Name",
flex: 2,
sortable: true,
//renderer: Ext.util.Format.usMoney,
dataIndex: 'name'
},
{
text: "Surname",
flex: 2,
sortable: true,
dataIndex: 'surname'
},
{
text: "Phone",
flex: 2,
sortable: false,
dataIndex: 'phone'
}
]
}
],
tbar:[{
text:'Add Something',
tooltip:'Add a new row',
iconCls:'add' // <------------
//handler: 'addClient'
}, '-', {
.
.
.
I can query the "Add Something" button sucessfully with
Code:
Ext.ComponentQuery.query("#client-win button[iconCls=add]")
or
Code:
Ext.ComponentQuery.query("window#client-win button[iconCls=add]")
And I have:
Code:
Ext.define('Desktop.controller.ClientWindow', {
extend: 'Ext.app.Controller',
alias: 'controller.ClientWindow',
//views: ['Desktop.ClientWindow'],
/* refs: [{
addClientButton: '#client-win button[iconCls=add]'
}], */
control: {
'#client-win button[iconCls=add]':{
click: 'addClient',
activate: 'test'
}
},
addClient: function() {
alert("Hello! I am an alert box!!");
},
test: function() {
console.log("fffff");
}
});
I can also see from the network tab that the controller I have created is loading to the browser: the controller\ClientWindow.js file.
But when I click the "Add Something" button nothing happens. What I'm missing?