Upgrade to ExtJS 3.0.0 - Released 07/06/2009
[extjs.git] / docs / source / TimeField.html
diff --git a/docs/source/TimeField.html b/docs/source/TimeField.html
new file mode 100644 (file)
index 0000000..74b0906
--- /dev/null
@@ -0,0 +1,149 @@
+<html>\r
+<head>\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
+ * <pre><code>\r
+new Ext.form.TimeField({\r
+    minValue: '9:00 AM',\r
+    maxValue: '6:00 PM',\r
+    increment: 30\r
+});\r
+</code></pre>\r
+ * @constructor\r
+ * Create a new TimeField\r
+ * @param {Object} config\r
+ * @xtype timefield\r
+ */\r
+Ext.form.TimeField = Ext.extend(Ext.form.ComboBox, {\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
+     */\r
+    minValue : null,\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
+     */\r
+    maxValue : null,\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
+     * 'The time in this field must be equal to or after {0}').\r
+     */\r
+    minText : "The time in this field must be equal to or after {0}",\r
+    <div id="cfg-Ext.form.TimeField-maxText"></div>/**\r
+     * @cfg {String} maxText\r
+     * The error text to display when the time is after maxValue (defaults to\r
+     * 'The time in this field must be equal to or before {0}').\r
+     */\r
+    maxText : "The time in this field must be equal to or before {0}",\r
+    <div id="cfg-Ext.form.TimeField-invalidText"></div>/**\r
+     * @cfg {String} invalidText\r
+     * The error text to display when the time in the field is invalid (defaults to\r
+     * '{value} is not a valid time').\r
+     */\r
+    invalidText : "{0} is not a valid time",\r
+    <div id="cfg-Ext.form.TimeField-format"></div>/**\r
+     * @cfg {String} format\r
+     * The default time format string which can be overriden for localization support.  The format must be\r
+     * valid according to {@link Date#parseDate} (defaults to 'g:i A', e.g., '3:15 PM').  For 24-hour time\r
+     * format try 'H:i' instead.\r
+     */\r
+    format : "g:i A",\r
+    <div id="cfg-Ext.form.TimeField-altFormats"></div>/**\r
+     * @cfg {String} altFormats\r
+     * Multiple date formats separated by "|" to try when parsing a user input value and it doesn't match the defined\r
+     * 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').\r
+     */\r
+    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",\r
+    <div id="cfg-Ext.form.TimeField-increment"></div>/**\r
+     * @cfg {Number} increment\r
+     * The number of minutes between each time value in the list (defaults to 15).\r
+     */\r
+    increment: 15,\r
+\r
+    // private override\r
+    mode: 'local',\r
+    // private override\r
+    triggerAction: 'all',\r
+    // private override\r
+    typeAhead: false,\r
+    \r
+    // private - This is the date to use when generating time values in the absence of either minValue\r
+    // or maxValue.  Using the current date causes DST issues on DST boundary dates, so this is an \r
+    // arbitrary "safe" date that can be any date aside from DST boundary dates.\r
+    initDate: '1/1/2008',\r
+\r
+    // private\r
+    initComponent : function(){\r
+        if(typeof this.minValue == "string"){\r
+            this.minValue = this.parseDate(this.minValue);\r
+        }\r
+        if(typeof this.maxValue == "string"){\r
+            this.maxValue = this.parseDate(this.maxValue);\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
+        }\r
+        Ext.form.TimeField.superclass.initComponent.call(this);\r
+    },\r
+\r
+    // inherited docs\r
+    getValue : function(){\r
+        var v = Ext.form.TimeField.superclass.getValue.call(this);\r
+        return this.formatDate(this.parseDate(v)) || '';\r
+    },\r
+\r
+    // inherited docs\r
+    setValue : function(value){\r
+        return Ext.form.TimeField.superclass.setValue.call(this, this.formatDate(this.parseDate(value)));\r
+    },\r
+\r
+    // private overrides\r
+    validateValue : Ext.form.DateField.prototype.validateValue,\r
+    parseDate : Ext.form.DateField.prototype.parseDate,\r
+    formatDate : Ext.form.DateField.prototype.formatDate,\r
+\r
+    // private\r
+    beforeBlur : function(){\r
+        var v = this.parseDate(this.getRawValue());\r
+        if(v){\r
+            this.setValue(v.dateFormat(this.format));\r
+        }\r
+        Ext.form.TimeField.superclass.beforeBlur.call(this);\r
+    }\r
+\r
+    <div id="cfg-Ext.form.TimeField-grow"></div>/**\r
+     * @cfg {Boolean} grow @hide\r
+     */\r
+    <div id="cfg-Ext.form.TimeField-growMin"></div>/**\r
+     * @cfg {Number} growMin @hide\r
+     */\r
+    <div id="cfg-Ext.form.TimeField-growMax"></div>/**\r
+     * @cfg {Number} growMax @hide\r
+     */\r
+    <div id="method-Ext.form.TimeField-autoSize"></div>/**\r
+     * @hide\r
+     * @method autoSize\r
+     */\r
+});\r
+Ext.reg('timefield', Ext.form.TimeField);</pre>    \r
+</body>\r
+</html>
\ No newline at end of file