X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/7a654f8d43fdb43d78b63d90528bed6e86b608cc..3789b528d8dd8aad4558e38e22d775bcab1cbd36:/docs/source/Date.html diff --git a/docs/source/Date.html b/docs/source/Date.html index 380e5b16..17f6d66c 100644 --- a/docs/source/Date.html +++ b/docs/source/Date.html @@ -1,4 +1,21 @@ -Sencha Documentation Project
/**
+
+
+
+  
+  The source code
+  
+  
+  
+  
+
+
+  
/**
  * @class Ext.form.field.Date
  * @extends Ext.form.field.Picker
 
@@ -80,71 +97,71 @@ Ext.define('Ext.form.field.Date', {
     requires: ['Ext.picker.Date'],
     alternateClassName: ['Ext.form.DateField', 'Ext.form.Date'],
 
-    /**
+    /**
      * @cfg {String} format
      * The default date format string which can be overriden for localization support.  The format must be
      * valid according to {@link Ext.Date#parse} (defaults to <tt>'m/d/Y'</tt>).
      */
     format : "m/d/Y",
-    /**
+    /**
      * @cfg {String} altFormats
      * Multiple date formats separated by "<tt>|</tt>" to try when parsing a user input value and it
      * does not match the defined format (defaults to
      * <tt>'m/d/Y|n/j/Y|n/j/y|m/j/y|n/d/y|m/j/Y|n/d/Y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d|Y-m-d|n-j|n/j'</tt>).
      */
     altFormats : "m/d/Y|n/j/Y|n/j/y|m/j/y|n/d/y|m/j/Y|n/d/Y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d|Y-m-d|n-j|n/j",
-    /**
+    /**
      * @cfg {String} disabledDaysText
      * The tooltip to display when the date falls on a disabled day (defaults to <tt>'Disabled'</tt>)
      */
     disabledDaysText : "Disabled",
-    /**
+    /**
      * @cfg {String} disabledDatesText
      * The tooltip text to display when the date falls on a disabled date (defaults to <tt>'Disabled'</tt>)
      */
     disabledDatesText : "Disabled",
-    /**
+    /**
      * @cfg {String} minText
      * The error text to display when the date in the cell is before <tt>{@link #minValue}</tt> (defaults to
      * <tt>'The date in this field must be after {minValue}'</tt>).
      */
     minText : "The date in this field must be equal to or after {0}",
-    /**
+    /**
      * @cfg {String} maxText
      * The error text to display when the date in the cell is after <tt>{@link #maxValue}</tt> (defaults to
      * <tt>'The date in this field must be before {maxValue}'</tt>).
      */
     maxText : "The date in this field must be equal to or before {0}",
-    /**
+    /**
      * @cfg {String} invalidText
      * The error text to display when the date in the field is invalid (defaults to
      * <tt>'{value} is not a valid date - it must be in the format {format}'</tt>).
      */
     invalidText : "{0} is not a valid date - it must be in the format {1}",
-    /**
+    /**
      * @cfg {String} triggerCls
      * An additional CSS class used to style the trigger button.  The trigger will always get the
      * class <tt>'x-form-trigger'</tt> and <tt>triggerCls</tt> will be <b>appended</b> if specified
      * (defaults to <tt>'x-form-date-trigger'</tt> which displays a calendar icon).
      */
     triggerCls : Ext.baseCSSPrefix + 'form-date-trigger',
-    /**
+    /**
      * @cfg {Boolean} showToday
      * <tt>false</tt> to hide the footer area of the Date picker containing the Today button and disable
      * the keyboard handler for spacebar that selects the current date (defaults to <tt>true</tt>).
      */
     showToday : true,
-    /**
+    /**
      * @cfg {Date/String} minValue
      * The minimum allowed date. Can be either a Javascript date object or a string date in a
      * valid format (defaults to undefined).
      */
-    /**
+    /**
      * @cfg {Date/String} maxValue
      * The maximum allowed date. Can be either a Javascript date object or a string date in a
      * valid format (defaults to undefined).
      */
-    /**
+    /**
      * @cfg {Array} disabledDays
      * An array of days to disable, 0 based (defaults to undefined). Some examples:<pre><code>
 // disable Sunday and Saturday:
@@ -153,7 +170,7 @@ disabledDays:  [0, 6]
 disabledDays: [1,2,3,4,5]
      * </code></pre>
      */
-    /**
+    /**
      * @cfg {Array} disabledDates
      * An array of "dates" to disable, as strings. These strings will be used to build a dynamic regular
      * expression so they are very powerful. Some examples:<pre><code>
@@ -173,7 +190,7 @@ disabledDates: ["^03"]
      * it, you will have to escape the dot when restricting dates. For example: <tt>["03\\.08\\.03"]</tt>.
      */
     
-    /**
+    /**
      * @cfg {String} submitFormat The date format string which will be submitted to the server.  
      * The format must be valid according to {@link Ext.Date#parse} (defaults to <tt>{@link #format}</tt>).
      */
@@ -185,7 +202,7 @@ disabledDates: ["^03"]
     initTimeFormat: 'H',
 
     matchFieldWidth: false,
-    /**
+    /**
      * @cfg {Number} startDay
      * Day index at which the week should begin, 0-based (defaults to 0, which is Sunday)
      */
@@ -239,7 +256,7 @@ disabledDates: ["^03"]
         }
     },
 
-    /**
+    /**
      * Replaces any existing disabled dates with new values and refreshes the Date picker.
      * @param {Array} disabledDates An array of date strings (see the <tt>{@link #disabledDates}</tt> config
      * for details on supported values) used to disable a pattern of dates.
@@ -255,7 +272,7 @@ disabledDates: ["^03"]
         }
     },
 
-    /**
+    /**
      * Replaces any existing disabled days (by index, 0-6) with new values and refreshes the Date picker.
      * @param {Array} disabledDays An array of disabled day indexes. See the <tt>{@link #disabledDays}</tt>
      * config for details on supported values.
@@ -269,7 +286,7 @@ disabledDates: ["^03"]
         }
     },
 
-    /**
+    /**
      * Replaces any existing <tt>{@link #minValue}</tt> with the new value and refreshes the Date picker.
      * @param {Date} value The minimum date that can be selected
      */
@@ -285,7 +302,7 @@ disabledDates: ["^03"]
         }
     },
 
-    /**
+    /**
      * Replaces any existing <tt>{@link #maxValue}</tt> with the new value and refreshes the Date picker.
      * @param {Date} value The maximum date that can be selected
      */
@@ -301,7 +318,7 @@ disabledDates: ["^03"]
         }
     },
 
-    /**
+    /**
      * Runs all of Date's validations and returns an array of any errors. Note that this first
      * runs Text's validations, so the returned array is an amalgamation of all field errors.
      * The additional validation checks are testing that the date format is valid, that the chosen
@@ -375,7 +392,7 @@ disabledDates: ["^03"]
         return this.formatDate(this.parseDate(value));
     },
 
-    /**
+    /**
      * Sets the value of the date field.  You can pass a date object or any string that can be
      * parsed into a valid date, using <tt>{@link #format}</tt> as the date format, according
      * to the same rules as {@link Ext.Date#parse} (the default format used is <tt>"m/d/Y"</tt>).
@@ -399,7 +416,7 @@ dateField.setValue('2006-05-04');
      * @method setValue
      */
 
-    /**
+    /**
      * Attempts to parse a given string value using a given {@link Ext.Date#parse date format}.
      * @param {String} value The value to attempt to parse
      * @param {String} format A valid date format (see {@link Ext.Date#parse})
@@ -433,7 +450,7 @@ dateField.setValue('2006-05-04');
         return value ? Ext.Date.format(value, format) : null;
     },
 
-    /**
+    /**
      * @private
      */
     parseDate : function(value) {
@@ -468,7 +485,7 @@ dateField.setValue('2006-05-04');
             format = Ext.String.format;
 
         return Ext.create('Ext.picker.Date', {
-            ownerCt: this.ownerCt,
+            ownerCt: me.ownerCt,
             renderTo: document.body,
             floating: true,
             hidden: true,
@@ -497,22 +514,24 @@ dateField.setValue('2006-05-04');
     },
 
     onSelect: function(m, d) {
-        this.setValue(d);
-        this.fireEvent('select', this, d);
-        this.collapse();
+        var me = this;
+        
+        me.setValue(d);
+        me.fireEvent('select', me, d);
+        me.collapse();
     },
 
-    /**
+    /**
      * @private
      * Sets the Date picker's value to match the current field value when expanding.
      */
     onExpand: function() {
         var me = this,
             value = me.getValue();
-        me.picker.setValue(value instanceof Date ? value : new Date());
+        me.picker.setValue(Ext.isDate(value) ? value : new Date());
     },
 
-    /**
+    /**
      * @private
      * Focuses the field when collapsing the Date picker.
      */
@@ -522,24 +541,33 @@ dateField.setValue('2006-05-04');
 
     // private
     beforeBlur : function(){
-        var v = this.parseDate(this.getRawValue());
-        if(v){
-            this.setValue(v);
+        var me = this,
+            v = me.parseDate(me.getRawValue()),
+            focusTask = me.focusTask;
+        
+        if (focusTask) {
+            focusTask.cancel();
+        }
+        
+        if (v) {
+            me.setValue(v);
         }
     }
 
-    /**
+    /**
      * @cfg {Boolean} grow @hide
      */
-    /**
+    /**
      * @cfg {Number} growMin @hide
      */
-    /**
+    /**
      * @cfg {Number} growMax @hide
      */
-    /**
+    /**
      * @hide
      * @method autoSize
      */
 });
-
\ No newline at end of file +
+ +