Quote Originally Posted by geoffrey.mcgill View Post
Triple check that no JavaScript errors are thrown during the recreation of the components.
Hi mcgill

Thanks for the response

i have managed to extract the Js code that our method producess when we create the field

The code is:


field = {
                        id: config.text + "_fieldLess",
                        border: false,
                        items: [
                             { id: config.dataIndex + "_Less_Date",
                                 xtype: "datefield",
                                 anchor: "100%",
                                 flex: 1,
                                 name: "dateLessDate",
                                 emptyText: "From",
                                 altFormats: "d-m-Y",
                                 format: "d-m-Y", submitFormat: "Y-m-d",
                                 readOnly: true,
                                 selectOnFocus: false 
                              },
                             { id: config.dataIndex + "_Less_Time",
                                 type: "liaTimeField",
                                 xtype: "numberfield",
                                 forcePrecision: true,
                                 decimalSeparator: ":",
                                 anchor: "100%", flex: 1,
                                 name: "dateLessTime",
                                 step: 0.01, maxValue: 23.59,
                                 minValue: 0.00, readOnly: false,
                                 selectOnFocus: true 
                              }
                        ],
                        layout: "hbox",
                        bodyPadding: 0,
                        defaults: { "margins": "0 5 0 0" }
                    }
as you can there is northing out of the ordinary when we create the field, and in the first we create it works as it should be
Its only the second time that we create it that it wont recevice focus.

the reson we specified the field "type" is because of the override of valueTo:

Code for that is:


// Overrides Numberfield decimals precision
Ext.override(Ext.form.NumberField, {
    forcePrecision: false,

    valueToRaw: function (value) {
        var me = this,
            decimalSeparator = me.decimalSeparator;
        value = me.parseValue(value);
        value = me.fixPrecision(value);
        value = Ext.isNumber(value) ? value : parseFloat(String(value).replace(decimalSeparator, '.'));
        if (isNaN(value)) {
            value = '';
        } else {
            if (me.type == "liaTimeField") {
                var hourIndex = String(value).indexOf(".");
                if (hourIndex == -1) {
                    var hours = value;
                }
                else {
                    var hours = String(value).substring(0, String(value).indexOf("."));
                }

                var step = me.step;

                var stepIndex = String(step).indexOf(".") + 1;
                var stepDecimal = String(step).substring(stepIndex, String(step).length);



                var decimalIndex = String(value).indexOf(".") + 1;
                var decimals = String(value).substring(decimalIndex, String(value).length);
                var diff = 0;
                if (decimals.length < 2) {
                    if (decimalIndex == 0) {
                        decimals = "00";
                    }
                    decimals += "0";
                }

                if (parseInt(decimals) > 59) {
                    if ((parseInt(decimals) + parseInt(stepDecimal)) >= 100) {
                        var number = (parseInt(decimals) + parseInt(stepDecimal));
                        var diffNumber = number - 100;
                        var diff = 60 - (parseInt(stepDecimal) - diffNumber);
                    }
                    else {
                        var diff = decimals - 60;
                        hours++;
                        if (diff < 10) {
                            diff = "0" + diff;
                        }

                    }
                    value = me.parseValue(hours + "." + diff);
                }
            }
            value = me.forcePrecision ? value.toFixed(me.decimalPrecision) : parseFloat(value);

            if (me.type == "liaTimeField") {
                if (hours < 10) {
                    value = String(value);
                    value = "0" + value;
                }
            }

            value = String(value).replace(".", decimalSeparator);
        }
        return value;
    }

})
Hope this helps abit more on the subject.

as mention earlier its only in IE that this behavior occurs..

Regards

Akpenob