PDA

View Full Version : Event capture in MVC for datefield defined in the grid toolbar



premier_la
11 Sep 2014, 5:01 AM
Using the MVC pattern how should I trap the event triggered in the Controller when the datefield is clicked.
This how the grid is, it has a docket item datefield.

Ext.define('App.view.admin.calendar.CalendarGrid' ,{
extend:'Ext.grid.Panel',
alias:'widget.admin-cal.calendargrid',
requires: [
'Ext.grid.plugin.RowEditing',
]
itemId: 'calenderGrid',
autoScroll:true,

initComponent: function() {

selType: 'rowmodel',
plugins: [
{
ptype: 'rowediting',
clicksToEdit: 2
}
],
columns: {
defaults: {},
items: [
{
text: 'Date',
xtype:'datecolumn',
dataIndex: 'dateIn',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
flex: .2
},
{
text: 'Weekday',
dataIndex: 'weekDay',
editor: {
xtype: 'textfield',
allowBlank: false
},
flex: .5
},
{
text: 'On-Call',
dataIndex: 'onCall',
editor: {
xtype: 'textfield',
allowBlank: false
},
flex: .5
},
{
text: 'On-Duty',
dataIndex: 'onDuty',
editor: {
xtype: 'textfield',
allowBlank: false
},
flex: .5
}
]
},
dockedItems: [
{
xtype: 'toolbar',
dock: 'top',
ui: 'footer',
items: [
{
xtype: 'datefield',
anchor: '100%',
itemId: 'dateCal',
name: 'Filter',
fieldLabel: 'Filter',
format: 'F Y',
value: new Date()
}
]
}

]
});
this.callParent( arguments );
}
});

scottmartin
11 Sep 2014, 2:28 PM
Something like this in your controller:



init : function () {
var me = this;

me.control({
'admin-cal.calendargrid datefield[itemId=dateCal]' : {
});
}