whisher
17 Jan 2012, 2:17 AM
Hi,
Ext.define('SA.view.user.List' ,{
extend: 'Ext.grid.Panel',
alias : 'widget.userlist',
title : 'All Users',
store: 'Users',
initComponent: function() {
this.columns = [
{
header: 'Id',
sortable: true,
dataIndex: 'id',
flex: 1,
field: {
type: 'textfield'
}
},
{
header: 'Name',
sortable: true,
dataIndex: 'uname',
flex: 1,
field: {
type: 'textfield'
}
},
{
header: 'Email',
sortable: true,
dataIndex: 'email',
flex: 1,
field: {
type: 'textfield'
}
}
];
this.callParent(arguments);
},
dockedItems: [
{
xtype: 'toolbar',
items: [{
iconCls: 'icon-add',
text: 'Add',
scope: this
}, {
iconCls: 'icon-delete',
text: 'Delete',
disabled: true,
itemId: 'delete',
scope: this
}]
},
{
xtype: 'pagingtoolbar',
store: 'Users', // same store GridPanel is using
dock: 'bottom',
displayInfo: true
}
]
});
I've added a simple add delete toolbar to my grid but how
I can add an event listener to my controller - controll for
the add button ?
init: function() {
this.control({
'userlist': {
itemdblclick: this.editUser
},
'userlist > toolbar/*my attempt but it doesnt work :( */': {
click: this.insertUser
},
'useredit button[action=save]': {
click: this.updateUser
}
});
},
Ext.define('SA.view.user.List' ,{
extend: 'Ext.grid.Panel',
alias : 'widget.userlist',
title : 'All Users',
store: 'Users',
initComponent: function() {
this.columns = [
{
header: 'Id',
sortable: true,
dataIndex: 'id',
flex: 1,
field: {
type: 'textfield'
}
},
{
header: 'Name',
sortable: true,
dataIndex: 'uname',
flex: 1,
field: {
type: 'textfield'
}
},
{
header: 'Email',
sortable: true,
dataIndex: 'email',
flex: 1,
field: {
type: 'textfield'
}
}
];
this.callParent(arguments);
},
dockedItems: [
{
xtype: 'toolbar',
items: [{
iconCls: 'icon-add',
text: 'Add',
scope: this
}, {
iconCls: 'icon-delete',
text: 'Delete',
disabled: true,
itemId: 'delete',
scope: this
}]
},
{
xtype: 'pagingtoolbar',
store: 'Users', // same store GridPanel is using
dock: 'bottom',
displayInfo: true
}
]
});
I've added a simple add delete toolbar to my grid but how
I can add an event listener to my controller - controll for
the add button ?
init: function() {
this.control({
'userlist': {
itemdblclick: this.editUser
},
'userlist > toolbar/*my attempt but it doesnt work :( */': {
click: this.insertUser
},
'useredit button[action=save]': {
click: this.updateUser
}
});
},