Permalink
Browse files

Added optional datatypes

  • Loading branch information...
1 parent 8667c01 commit 671446c84ed19c16b27558e4358b8668d11c421c @Munter Munter committed Mar 18, 2011
Showing with 14 additions and 1 deletion.
  1. +14 −1 src/platform/src/data/Types.js
@@ -189,4 +189,17 @@ Ext.data.Types = new function() {
*/
NUMBER: this.FLOAT
});
-};
+
+ Ext.iterate(this, function (key, value, obj) {
+ if (value.convert) {
+ var fn = value.convert;
+ obj[key] = {
+ convert: function (v) {
+ return (this.optional && (v === undefined || v === null)) ? null : fn(v);
+ },
+ sortType: value.sortType,
+ type: value.type
+ };
+ }
+ });
+};

0 comments on commit 671446c

Please sign in to comment.