brunoflmg
30 Oct 2012, 4:24 AM
Hello Guys,
I need a help with controller actions...
I have a grid with toolbar buttons... the property "action" says to my controller with action I'll use... as follow:
// My view
Ext.define('Myproject.view.person.List',{
extend: 'Ext.grid.Panel'
alias: 'widget.personlist',
[...] // other properties
initComponent: function(){
this.dockedItems = [{
xtype: 'toolbar',
dock: 'top',
itemId: 'dockButtonTop',
items: [{
text: 'Insert',
iconCls: 'add',
menu: new Ext.menu.Menu({
items: [{
text: 'Person type one',
iconCls: 'user',
scope: this,
action: 'addone'
},{
text: 'Person type two',
iconCls: 'user',
scope: this,
action: 'addtwo'
}]
})
},{
text: 'Edit',
action: 'edit',
iconCls: 'edit'
}]
}]
this.callParent(arguments);
}
}
The problem is... my actions addone and addtwo does nothing in my controller. I think this buttons in the Ext.menu.Menu component was not binding the actions that I defined.
// my controller
Ext.define('Myproject.controller.Person',{
extend: 'Ext.app.Controller',
[...]
views : [
'person.List'
],
refs: [{
ref: 'gridList',
selector: 'personlist'
}],
init: function(){
this.control({
'personlist button[action=addone]': {
click: function(){
console.log('test one');
}
},
'personlist button[action=addtwo]': {
click: function(){
console.log('test one');
}
},
'personlist button[action=edit]': {
click: function(){
console.log('edit test');
}
}
});
}
}
So when I press the buttons inside my context buttons located in my toolbar nothing happens. The edit button works fine! :(
What I suppose to do?
I need a help with controller actions...
I have a grid with toolbar buttons... the property "action" says to my controller with action I'll use... as follow:
// My view
Ext.define('Myproject.view.person.List',{
extend: 'Ext.grid.Panel'
alias: 'widget.personlist',
[...] // other properties
initComponent: function(){
this.dockedItems = [{
xtype: 'toolbar',
dock: 'top',
itemId: 'dockButtonTop',
items: [{
text: 'Insert',
iconCls: 'add',
menu: new Ext.menu.Menu({
items: [{
text: 'Person type one',
iconCls: 'user',
scope: this,
action: 'addone'
},{
text: 'Person type two',
iconCls: 'user',
scope: this,
action: 'addtwo'
}]
})
},{
text: 'Edit',
action: 'edit',
iconCls: 'edit'
}]
}]
this.callParent(arguments);
}
}
The problem is... my actions addone and addtwo does nothing in my controller. I think this buttons in the Ext.menu.Menu component was not binding the actions that I defined.
// my controller
Ext.define('Myproject.controller.Person',{
extend: 'Ext.app.Controller',
[...]
views : [
'person.List'
],
refs: [{
ref: 'gridList',
selector: 'personlist'
}],
init: function(){
this.control({
'personlist button[action=addone]': {
click: function(){
console.log('test one');
}
},
'personlist button[action=addtwo]': {
click: function(){
console.log('test one');
}
},
'personlist button[action=edit]': {
click: function(){
console.log('edit test');
}
}
});
}
}
So when I press the buttons inside my context buttons located in my toolbar nothing happens. The edit button works fine! :(
What I suppose to do?