PDA

View Full Version : My Clock dont run ...



terra75
12 Apr 2014, 8:30 AM
Hi !

here my Code.

Ext.define('APP.view.Header', {
extend : 'Ext.toolbar.Toolbar',
alias : 'widget.HeaderPanel',

initComponent : function () {
var me = this;

Ext.apply(me, {
id : 'mainHeader',
border : false,
cls: 'header',
height : 50,
padding: '0',
style : {
overflow : 'visible'
},

items : [{
xtype: 'box',
html: '<span class="logo">....</span><br><span class="desk">.....</span>'
}, '->', {
xtype: 'box',
html: '<div class="watch"><span class="clock">00:00:00 Uhr</span><br><span class="date">Montag, 01. Januar 2000</span></div>'
}],

listeners : {
render :function() {
Ext.TaskManager.start({
run : function() {
Ext.get('clock').update(Ext.Date.format(new Date(), 'g:i:s A' ));
},
scope: me,
interval : 1000
});
}
}



});
me.callParent();
}
});



If i run my Code, the Clock is not work. Why?
Can anyone help me?

Thanks !

Terra

firefoxSafari
12 Apr 2014, 11:17 AM
Ext.get( ... ) looks up by dom id. You have nothing with dom id 'clock'. You either need to use query methods to look up by class or put an id on your span.


items : [{
xtype: 'box',
html: '<span class="logo">....</span><br><span class="desk">.....</span>'
}, '->', {
xtype: 'box',
html: '<div class="watch"><span class="clock" id="clock">00:00:00 Uhr</span><br><span class="date">Montag, 01. Januar 2000</span></div>'
}],

terra75
12 Apr 2014, 12:32 PM
Oh yes ... itīs work. :-) Thank`s