git.ithinksw.org
/
extjs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Upgrade to ExtJS 4.0.7 - Released 10/19/2011
[extjs.git]
/
src
/
data
/
Errors.js
diff --git
a/src/data/Errors.js
b/src/data/Errors.js
index
3aed68e
..
7d56514
100644
(file)
--- a/
src/data/Errors.js
+++ b/
src/data/Errors.js
@@
-16,13
+16,13
@@
If you are unsure which license is appropriate for your use, please contact the
* @author Ed Spencer
* @class Ext.data.Errors
* @extends Ext.util.MixedCollection
* @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>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>
* <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();
<pre><code>
//validate some existing model instance - in this case it returned 2 failures messages
var errors = myModel.validate();
@@
-36,32
+36,32
@@
errors.getByField('title'); // [{field: 'title', message: 'is too short'}]
*/
Ext.define('Ext.data.Errors', {
extend: 'Ext.util.MixedCollection',
*/
Ext.define('Ext.data.Errors', {
extend: 'Ext.util.MixedCollection',
-
+
/**
* Returns true if there are no errors in the collection
/**
* Returns true if there are no errors in the collection
- * @return {Boolean}
+ * @return {Boolean}
*/
isValid: function() {
return this.length === 0;
},
*/
isValid: function() {
return this.length === 0;
},
-
+
/**
* Returns all of the errors for the given field
* @param {String} fieldName The field to get errors for
/**
* 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;
*/
getByField: function(fieldName) {
var errors = [],
error, field, i;
-
+
for (i = 0; i < this.length; i++) {
error = this.items[i];
for (i = 0; i < this.length; i++) {
error = this.items[i];
-
+
if (error.field == fieldName) {
errors.push(error);
}
}
if (error.field == fieldName) {
errors.push(error);
}
}
-
+
return errors;
}
});
return errors;
}
});