Reputation: 1203
how to show a calendar when you click on text field icon on the left of the calendar?
Upvotes: 0
Views: 1433
Reputation: 642
Alin Suciu's answer is not enough for extjs 5. Because when click datepicker image, picker does not trigger. So i changed it a little. it's not best way but working.
listeners: {
afterrender: function (d) {
d.getEl().on('click', function (e, t, o) {
if (e.target.id.indexOf('picker') <= 0) {
d.onTriggerClick();
}
});
}
}
if there is any better solution advice, i will change my code. Best regards.
Upvotes: 0
Reputation:
{
xtype:'datefield',
fieldLabel:'Start Date',
name:'start_date',
dataIndex:'start_date'
}
use the items[] for the field container and put above lines for datefield in items and call it
Upvotes: 1
Reputation: 121
Use the 'render' event to listen to clicks on the datefield, then use the onTriggerClick() function to expand the date picker:
{
xtype:'datefield',
name:'date1',
fieldLabel:'Date',
listeners:{
render:function (d) {
d.el.on('click', function () {
d.onTriggerClick();
});
}
}
}
Upvotes: 1