1
當用戶從datepickerfield組件中選擇一個日期時(他們點擊內置的「完成」按鈕時),我需要觸發一個事件。除了別的之外,我試圖引用按鈕的「操作」,但沒有運氣。如何在Sencha Touch datepickerfield中引用「完成」按鈕
有關如何從datepickerfield「完成」按鈕創建ref(或處理程序或偵聽器)的任何信息將不勝感激。
下面是我查看部分:
items:[{
xtype: 'button',
align: 'right',
text: 'Mark all present',
action: 'markAllPresent'
},
{
xtype: 'datepickerfield',
cls: 'pickAdate',
align: 'left',
label: 'Date',
name: 'date',
value: new Date(),
picker : {
yearFrom: 2012,
toolbar : {
items : [
{
xtype: 'button',
ui: 'confirm',
text: 'Today',
align: 'right',
handler: function(button, event) {
var picker = button.up('datepicker');
picker.fireEvent('change', picker, Ext.DateExtras.clearTime(new Date()));
//Today button , clear date
}
}
]
}
},
doneButton:{
action: 'dateDone' //THIS DOES NOTHING ---------==============
},
listeners: {
change: function(picker, date) {
console.log(date);
var store = Ext.create('Ext.data.Store', {
model: 'App.model.NewDateModel',
id:'DateStore'
});
store.add(date);
store.setData(date);
store.sync();
this.fireEvent("newDatePicked", this);
// **DOES NOT FIRE EVENT IN MY CONTROLLER================
}
}
}]
而且我的控制器:
config: {
control: {
doneButton: {
newDatePicked: 'newDatePicked'
}
},
refs: {
doneButton: 'button[action=dateDone]'
}
},
newDatePicked: function(list, record) {
.....
}
感謝
完美!謝謝 :) – jakeed1 2013-03-02 03:25:52