gportela85/DateTimeField

override hourText and minuteText

Closed this issue · 1 comments

hi, It's me again.~
Now I'm using this datatimefield and it was useful,but I still can't override the hourText and minuteText.
I mean that I don't want change the values in your JS file.It was stupid.
So I think there was a little change in the code will solve the problem.


I change the file DateTimePicker.js

fieldLabel: me.hourText
to
fieldLabel: me.pickerField.hourText ? me.pickerField.hourText : me.hourText

and
fieldLabel: me.minuteText
to
fieldLabel: me.pickerField.minuteText ? me.pickerField.minuteText : me.minuteText


It works...

This should fix your issue

Ext.define('Ext.ux.DateTimeField',{
    override: 'Ext.ux.DateTimeField',
    createPicker: function() {
        var me = this,
            parentPicker = this.callSuper(),
            o = {}, key;
        for(key in parentPicker) {
            if (parentPicker.hasOwnProperty(key) && parentPicker[key]){
                o[key] = parentPicker[key];
            }
        }

        for (key in me.initialConfig) {
            if (me.initialConfig.hasOwnProperty(key) && me.initialConfig[key]) {
                o.initialConfig[key] = me.initialConfig[key];
            }
        }

        return Ext.create('Ext.ux.DateTimePicker', o);
    }
});