X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/7a654f8d43fdb43d78b63d90528bed6e86b608cc..refs/heads/master:/docs/source/Errors.html diff --git a/docs/source/Errors.html b/docs/source/Errors.html index 7fbdbcfe..34bee9c3 100644 --- a/docs/source/Errors.html +++ b/docs/source/Errors.html @@ -1,14 +1,31 @@ -
/**
+
+
+
+
+ The source code
+
+
+
+
+
+
+ /**
* @author Ed Spencer
* @class Ext.data.Errors
* @extends Ext.util.MixedCollection
- *
+ *
* <p>Wraps a collection of validation error responses and provides convenient functions for
* accessing and errors for specific fields.</p>
- *
+ *
* <p>Usually this class does not need to be instantiated directly - instances are instead created
* automatically when {@link Ext.data.Model#validate validate} on a model instance:</p>
- *
+ *
<pre><code>
//validate some existing model instance - in this case it returned 2 failures messages
var errors = myModel.validate();
@@ -16,39 +33,41 @@ var errors = myModel.validate();
errors.isValid(); //false
errors.length; //2
-errors.getByField('name'); // [{field: 'name', error: 'must be present'}]
-errors.getByField('title'); // [{field: 'title', error: 'is too short'}]
+errors.getByField('name'); // [{field: 'name', message: 'must be present'}]
+errors.getByField('title'); // [{field: 'title', message: 'is too short'}]
</code></pre>
*/
Ext.define('Ext.data.Errors', {
extend: 'Ext.util.MixedCollection',
-
- /**
+
+ /**
* Returns true if there are no errors in the collection
- * @return {Boolean}
+ * @return {Boolean}
*/
isValid: function() {
return this.length === 0;
},
-
- /**
+
+ /**
* Returns all of the errors for the given field
* @param {String} fieldName The field to get errors for
- * @return {Array} All errors for the given field
+ * @return {Object[]} All errors for the given field
*/
getByField: function(fieldName) {
var errors = [],
error, field, i;
-
+
for (i = 0; i < this.length; i++) {
error = this.items[i];
-
+
if (error.field == fieldName) {
errors.push(error);
}
}
-
+
return errors;
}
});
-
\ No newline at end of file
+
+
+