I've been trying to find an approach on how to fix the issue I have, but I could not find it in Google nor S.O, that's why I'm posting this question.
I have two components of type: timefield that are represented in this piece of code:
{
xtype: 'timefield',
format: 'H:i',
increment: 30,
name: 'shiftStartTime',
itemId: 'shiftStartTime',
fieldLabel: 'Shift Start Time',
required: true,
value: '00:00'
}, {
xtype: 'timefield',
format: 'H:i',
increment: 30,
name: 'shiftEndTime',
itemId: 'shiftEndTime',
fieldLabel: 'Shift End Time',
required: true,
value: '00:00'
},
What I'm doing is easy, actually, I'm trying to set a value for the fields based on an entity that comes from server. I already managed to retrieve the entity which has two fields: 'hour' and 'minute', I want to set the concatenated value to both components, but for some reason, it always display blank. Here's the piece of code I implemented in order to set the value:
setPreEnteredTimes: function(userProfileItem) {
var me = this,
shiftStartTimeComp = me.getItem('shiftStartTime'),
shiftEndTimeComp = me.getItem('shiftEndTime'),
hh = userProfileItem.get('hour'),
mm = userProfileItem.get('minute');
var displayStr = hh + ':' + mm;
shiftStartTimeComp.setValue(displayStr);
shiftEndTimeComp.setValue(displayStr);
},
I've already tried even creating a new Date
and using Ext.Date.format()
using H:i
but not working, the timefield is always displaying blank.
Version of ExtJS is 4.2.3
Thanks in advance.