View Full Version : datepickerfield without year slot?!?

21 Jan 2011, 10:10 AM
I'm trying to figure out how to make a datepickerfield with just the month and the day slot and without the year slot??
Here's the configuration code I'm trying to use

hidden: true,
title: 'Birthday',
cls: 'card2',
items: [{
xtype: 'fieldset',
items: [{
xtype: 'textfield',
name: 'title',
placeHolder: 'Whose Birthday?*',
required: true,
useClearIcon: true,
autoCapitalize : false
}, {
xtype: 'datepickerfield',
name: 'occurs_at',
useClearIcon: true,
required: true,
hideOnMaskTap: true,
picker: {
slots: [ 'month', 'day' ] //NOT WORKING
label: 'Date'
// ,value: new Date()

The picker sub-config with slot config is not working, any ideas, plz?

21 Jan 2011, 12:39 PM

picker: {
slotOrder: [ 'month', 'day' ]

May work.. not too sure tho. Let me know if it does

25 Jan 2011, 9:45 AM
Thanks simoens!
Yeah I can see clearly from this post that it works. However, in my case, apart from inheriting the problem mentioned in the above link, I also totally loose all the values in the day picker if I change the month picker value!?!
Should they be logged as two separate bugs?

11 Jul 2011, 7:17 AM
I have the same issue and found out that the problem is inside the Ext.DatePicker class. In the onSlotPick event handler function the day slot is set according to changes to the month and year slots without a check if the day slot actually exists.

// @private
onSlotPick: function(slot, value) {
var name = slot.name,
date, daysInMonth, daySlot;

if (name === "month" || name === "year") {
daySlot = this.child('[name=day]');
date = this.getValue();
daysInMonth = this.getDaysInMonth(date.getMonth()+1, date.getFullYear());
fn: function(r) {
return r.get('extra') === true || r.get('value') <= daysInMonth;

Ext.DatePicker.superclass.onSlotPick.apply(this, arguments);

11 Jul 2011, 7:19 AM
An easy way to do that is set the year yourself. This will keep the check but will use the year you set since you are omitting it from the picker.

Either that or make your own picker field with the two slots you want.