PDA

View Full Version : How use DatePicker?



PSB
12 Sep 2010, 8:58 AM
Hello. I try this code:



......................................
var task_form = new Ext.form.FormPanel({
id:"task_form",
scroll:"vertical",
layout:"fit",
items:[{
xtype:"fieldset",
title:"test",
items:[{
xtype:"datepicker",
name:"task_d_start",
label:"label",
useTitles: false,
value: {
day: 1,
month: 1,
year: 2010
},
required:true
}]
}]
});
......................................


....but datepicker is not showing. What I wrong?

evant
12 Sep 2010, 4:54 PM
Ext.setup({

onReady: function(){
var task_form = new Ext.form.FormPanel({
fullscreen: true,
id: "task_form",
layout: "fit",
items: [{
xtype: "fieldset",
title: "test",
items: [{
floating: false,
hidden: false,
xtype: "datepicker",
showDoneButton: false,
name: "task_d_start",
label: "label",
useTitles: false,
value: {
day: 1,
month: 1,
year: 2010
},
required: true
}]
}]
});
}

});

PSB
14 Sep 2010, 11:57 AM
Thanks for reply Evan. Now i try create autoclose datepicker field:



xtype:"textfield",
id:"task_d_start",
label:"Start",
listeners:{
focus:function(){
var datePicker = new Ext.DatePicker({
xtype:"datepicker",
id:"task_d_start_DP",
useTitles:false,
value:{
day:Ext.util.Format.date(Date(),"d"),
month:Ext.util.Format.date(Date(),"n"),
year:Ext.util.Format.date(Date(),"Y")
},
yearTo:2020,
required:true
});

datePicker.show();
...........................................................................


Question : How create "showDoneButton" event for close actionSheet ? Thanks for Great job !

PSB
15 Sep 2010, 2:46 AM
listeners:{
change:function(){
Ext.getCmp("task_d_start").setValue(Ext.util.Format.date(this.getValue(),"d.m.Y"));
}
},

rdougan
15 Sep 2010, 4:13 PM
A Date Picker Field with this functionality will be in the next release (.96) of Sencha Touch. :)