3
<title>The source code</title>
4
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
5
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>
7
<body onload="prettyPrint();">
8
<pre class="prettyprint lang-js"><div id="cls-Ext.form.TimeField"></div>/**
9
* @class Ext.form.TimeField
10
* @extends Ext.form.ComboBox
11
* Provides a time input field with a time dropdown and automatic time validation. Example usage:
13
new Ext.form.TimeField({
20
* Create a new TimeField
21
* @param {Object} config
24
Ext.form.TimeField = Ext.extend(Ext.form.ComboBox, {
25
<div id="cfg-Ext.form.TimeField-minValue"></div>/**
26
* @cfg {Date/String} minValue
27
* The minimum allowed time. Can be either a Javascript date object with a valid time value or a string
28
* time in a valid format -- see {@link #format} and {@link #altFormats} (defaults to null).
31
<div id="cfg-Ext.form.TimeField-maxValue"></div>/**
32
* @cfg {Date/String} maxValue
33
* The maximum allowed time. Can be either a Javascript date object with a valid time value or a string
34
* time in a valid format -- see {@link #format} and {@link #altFormats} (defaults to null).
37
<div id="cfg-Ext.form.TimeField-minText"></div>/**
38
* @cfg {String} minText
39
* The error text to display when the date in the cell is before minValue (defaults to
40
* 'The time in this field must be equal to or after {0}').
42
minText : "The time in this field must be equal to or after {0}",
43
<div id="cfg-Ext.form.TimeField-maxText"></div>/**
44
* @cfg {String} maxText
45
* The error text to display when the time is after maxValue (defaults to
46
* 'The time in this field must be equal to or before {0}').
48
maxText : "The time in this field must be equal to or before {0}",
49
<div id="cfg-Ext.form.TimeField-invalidText"></div>/**
50
* @cfg {String} invalidText
51
* The error text to display when the time in the field is invalid (defaults to
52
* '{value} is not a valid time').
54
invalidText : "{0} is not a valid time",
55
<div id="cfg-Ext.form.TimeField-format"></div>/**
56
* @cfg {String} format
57
* The default time format string which can be overriden for localization support. The format must be
58
* valid according to {@link Date#parseDate} (defaults to 'g:i A', e.g., '3:15 PM'). For 24-hour time
59
* format try 'H:i' instead.
62
<div id="cfg-Ext.form.TimeField-altFormats"></div>/**
63
* @cfg {String} altFormats
64
* Multiple date formats separated by "|" to try when parsing a user input value and it doesn't match the defined
65
* format (defaults to 'g:ia|g:iA|g:i a|g:i A|h:i|g:i|H:i|ga|ha|gA|h a|g a|g A|gi|hi|gia|hia|g|H').
67
altFormats : "g:ia|g:iA|g:i a|g:i A|h:i|g:i|H:i|ga|ha|gA|h a|g a|g A|gi|hi|gia|hia|g|H",
68
<div id="cfg-Ext.form.TimeField-increment"></div>/**
69
* @cfg {Number} increment
70
* The number of minutes between each time value in the list (defaults to 15).
81
// private - This is the date to use when generating time values in the absence of either minValue
82
// or maxValue. Using the current date causes DST issues on DST boundary dates, so this is an
83
// arbitrary "safe" date that can be any date aside from DST boundary dates.
87
initComponent : function(){
88
if(typeof this.minValue == "string"){
89
this.minValue = this.parseDate(this.minValue);
91
if(typeof this.maxValue == "string"){
92
this.maxValue = this.parseDate(this.maxValue);
96
var min = this.parseDate(this.minValue) || new Date(this.initDate).clearTime();
97
var max = this.parseDate(this.maxValue) || new Date(this.initDate).clearTime().add('mi', (24 * 60) - 1);
100
times.push(min.dateFormat(this.format));
101
min = min.add('mi', this.increment);
105
Ext.form.TimeField.superclass.initComponent.call(this);
109
getValue : function(){
110
var v = Ext.form.TimeField.superclass.getValue.call(this);
111
return this.formatDate(this.parseDate(v)) || '';
115
setValue : function(value){
116
return Ext.form.TimeField.superclass.setValue.call(this, this.formatDate(this.parseDate(value)));
120
validateValue : Ext.form.DateField.prototype.validateValue,
121
parseDate : Ext.form.DateField.prototype.parseDate,
122
formatDate : Ext.form.DateField.prototype.formatDate,
125
beforeBlur : function(){
126
var v = this.parseDate(this.getRawValue());
128
this.setValue(v.dateFormat(this.format));
130
Ext.form.TimeField.superclass.beforeBlur.call(this);
133
<div id="cfg-Ext.form.TimeField-grow"></div>/**
134
* @cfg {Boolean} grow @hide
136
<div id="cfg-Ext.form.TimeField-growMin"></div>/**
137
* @cfg {Number} growMin @hide
139
<div id="cfg-Ext.form.TimeField-growMax"></div>/**
140
* @cfg {Number} growMax @hide
142
<div id="method-Ext.form.TimeField-autoSize"></div>/**
147
Ext.reg('timefield', Ext.form.TimeField);</pre>
b'\\ No newline at end of file'