The Date and time formats of json returned by the background are usually similar to those of & quot; Date (1309200300000) & quot, the result is not displayed normally in TimeField. If you want to display the result correctly, the general method is to change the background code and convert the date and time format to string to return the result. The solution is to override the setValue of TimeField, the Code is as follows:
The Code is as follows:
Ext. override (Ext. form. TimeField ,{
GetValue: function (){
Return this. value;
},
SetValue: function (v ){
This. value = v;
This. setRawValue (this. formatValue (v ));
Return this;
},
FormatValue: function (v ){
If (v. length> 8) {// The maximum number of timefield values greater than 8 must be in json
Var jsondate = eval ("new" + v. substr (1, v. length-2). toLocaleTimeString ();
Jsondate = jsondate. length = 8? Jsondate. substr (0, 5): '0' + jsondate. substr (0, 4); // toLocaleTimeString is relatively retarded. If the returned hour is less than 10 hours, only one digit is returned.
Return jsondate;
}
Return v;
}
});