-<html>
-<head>
- <title>The source code</title>
- <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
- <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
-</head>
-<body onload="prettyPrint();">
- <pre class="prettyprint lang-js">/*!
- * Ext JS Library 3.0.3
- * Copyright(c) 2006-2009 Ext JS, LLC
- * licensing@extjs.com
- * http://www.extjs.com/license
- */
-<div id="cls-Ext.form.TimeField"></div>/**\r
+<html>\r
+<head>\r
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> \r
+ <title>The source code</title>\r
+ <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
+ <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
+</head>\r
+<body onload="prettyPrint();">\r
+ <pre class="prettyprint lang-js"><div id="cls-Ext.form.TimeField"></div>/**\r
* @class Ext.form.TimeField\r
* @extends Ext.form.ComboBox\r
* Provides a time input field with a time dropdown and automatic time validation. Example usage:\r
<div id="cfg-Ext.form.TimeField-minValue"></div>/**\r
* @cfg {Date/String} minValue\r
* The minimum allowed time. Can be either a Javascript date object with a valid time value or a string \r
- * time in a valid format -- see {@link #format} and {@link #altFormats} (defaults to null).\r
+ * time in a valid format -- see {@link #format} and {@link #altFormats} (defaults to undefined).\r
*/\r
- minValue : null,\r
+ minValue : undefined,\r
<div id="cfg-Ext.form.TimeField-maxValue"></div>/**\r
* @cfg {Date/String} maxValue\r
* The maximum allowed time. Can be either a Javascript date object with a valid time value or a string \r
- * time in a valid format -- see {@link #format} and {@link #altFormats} (defaults to null).\r
+ * time in a valid format -- see {@link #format} and {@link #altFormats} (defaults to undefined).\r
*/\r
- maxValue : null,\r
+ maxValue : undefined,\r
<div id="cfg-Ext.form.TimeField-minText"></div>/**\r
* @cfg {String} minText\r
* The error text to display when the date in the cell is before minValue (defaults to\r
\r
// private\r
initComponent : function(){\r
- if(typeof this.minValue == "string"){\r
- this.minValue = this.parseDate(this.minValue);\r
+ if(Ext.isDefined(this.minValue)){\r
+ this.setMinValue(this.minValue, true);\r
}\r
- if(typeof this.maxValue == "string"){\r
- this.maxValue = this.parseDate(this.maxValue);\r
+ if(Ext.isDefined(this.maxValue)){\r
+ this.setMaxValue(this.maxValue, true);\r
}\r
-\r
if(!this.store){\r
- var min = this.parseDate(this.minValue) || new Date(this.initDate).clearTime();\r
- var max = this.parseDate(this.maxValue) || new Date(this.initDate).clearTime().add('mi', (24 * 60) - 1);\r
- var times = [];\r
- while(min <= max){\r
- times.push(min.dateFormat(this.format));\r
- min = min.add('mi', this.increment);\r
- }\r
- this.store = times;\r
+ this.generateStore(true);\r
}\r
Ext.form.TimeField.superclass.initComponent.call(this);\r
},\r
+ \r
+ <div id="method-Ext.form.TimeField-setMinValue"></div>/**\r
+ * Replaces any existing {@link #minValue} with the new time and refreshes the store.\r
+ * @param {Date/String} value The minimum time that can be selected\r
+ */\r
+ setMinValue: function(value, /* private */ initial){\r
+ this.setLimit(value, true, initial);\r
+ return this;\r
+ },\r
+\r
+ <div id="method-Ext.form.TimeField-setMaxValue"></div>/**\r
+ * Replaces any existing {@link #maxValue} with the new time and refreshes the store.\r
+ * @param {Date/String} value The maximum time that can be selected\r
+ */\r
+ setMaxValue: function(value, /* private */ initial){\r
+ this.setLimit(value, false, initial);\r
+ return this;\r
+ },\r
+ \r
+ // private\r
+ generateStore: function(initial){\r
+ var min = this.minValue || new Date(this.initDate).clearTime(),\r
+ max = this.maxValue || new Date(this.initDate).clearTime().add('mi', (24 * 60) - 1),\r
+ times = [];\r
+ \r
+ while(min <= max){\r
+ times.push(min.dateFormat(this.format));\r
+ min = min.add('mi', this.increment);\r
+ }\r
+ this.bindStore(times, initial);\r
+ },\r
\r
+ // private\r
+ setLimit: function(value, isMin, initial){\r
+ var d;\r
+ if(Ext.isString(value)){\r
+ d = this.parseDate(value);\r
+ }else if(Ext.isDate(value)){\r
+ d = value;\r
+ }\r
+ if(d){\r
+ var val = new Date(this.initDate).clearTime();\r
+ val.setHours(d.getHours(), d.getMinutes(), isMin ? 0 : 59, 0);\r
+ this[isMin ? 'minValue' : 'maxValue'] = val;\r
+ if(!initial){\r
+ this.generateStore();\r
+ }\r
+ }\r
+ },\r
+ \r
// inherited docs\r
getValue : function(){\r
var v = Ext.form.TimeField.superclass.getValue.call(this);\r
* @method autoSize\r
*/\r
});\r
-Ext.reg('timefield', Ext.form.TimeField);</pre>
-</body>
+Ext.reg('timefield', Ext.form.TimeField);</pre> \r
+</body>\r
</html>
\ No newline at end of file