From: Edward Date: Wed, 19 Nov 2014 04:03:11 +0000 (+0800) Subject: roojs-core.js X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=1820308cd2b126ec4b6a7ef48e7e8a13874dbf31 roojs-core.js roojs-core-debug.js roojs-ui.js roojs-ui-debug.js roojs-all.js roojs-debug.js --- diff --git a/roojs-all.js b/roojs-all.js index dc7f700f3e..0f06e83bf9 100644 --- a/roojs-all.js +++ b/roojs-all.js @@ -437,7 +437,7 @@ Roo.data.Field=function(A){if(typeof A=="string"){A={name:A};} Roo.apply(this,A);if(!this.type){this.type="auto";}var st=Roo.data.SortTypes;if(typeof this.sortType=="string"){this.sortType=st[this.sortType];}if(!this.sortType){switch(this.type){case "string":this.sortType=st.asUCString;break;case "date":this.sortType=st.asDate;break;default:this.sortType=st.none;}}var B=/[\$,%]/g;if(!this.convert){var cv,C=this.dateFormat;switch(this.type){case "":case "auto":case undefined:cv=function(v){return v;};break;case "string":cv=function(v){return (v===undefined||v===null)?'':String(v);};break;case "int":cv=function(v){return v!==undefined&&v!==null&&v!==''?parseInt(String(v).replace(B,""),10):'';};break;case "float":cv=function(v){return v!==undefined&&v!==null&&v!==''?parseFloat(String(v).replace(B,""),10):'';};break;case "bool":case "boolean":cv=function(v){return v===true||v==="true"||v==1;};break;case "date":cv=function(v){if(!v){return '';}if(v instanceof Date){return v;}if(C){if(C=="timestamp"){return new Date(v*1000);}return Date.parseDate(v,C);}var D=Date.parse(v);return D?new Date(D):null;};break;} this.convert=cv;}};Roo.data.Field.prototype={dateFormat:null,defaultValue:"",mapping:null,sortType:null,sortDir:"ASC"}; //Roo/data/DataReader.js -Roo.data.DataReader=function(A,B){this.meta=A;this.recordType=B instanceof Array?Roo.data.Record.create(B):B;};Roo.data.DataReader.prototype={newRow:function(d){var da={};this.recordType.prototype.fields.each(function(c){switch(c.type){case 'int':da[c.name]=0;break;case 'date':da[c.name]=new Date();break;case 'float':da[c.name]=0.0;break;case 'boolean':da[c.name]=false;break;case 'array':da[c.name]=[];break;default:da[c.name]="";break;}});return new this.recordType(Roo.apply(da,d));}}; +Roo.data.DataReader=function(A,B){this.meta=A;this.recordType=B instanceof Array?Roo.data.Record.create(B):B;};Roo.data.DataReader.prototype={newRow:function(d){var da={};this.recordType.prototype.fields.each(function(c){switch(c.type){case 'int':da[c.name]=0;break;case 'date':da[c.name]=new Date();break;case 'float':da[c.name]=0.0;break;case 'boolean':da[c.name]=false;break;default:da[c.name]="";break;}});return new this.recordType(Roo.apply(da,d));}}; //Roo/data/DataProxy.js Roo.data.DataProxy=function(){this.addEvents({beforeload:true,load:true,loadexception:true});Roo.data.DataProxy.superclass.constructor.call(this);};Roo.extend(Roo.data.DataProxy,Roo.util.Observable); //Roo/data/MemoryProxy.js diff --git a/roojs-debug.js b/roojs-debug.js index 9d5f3f1da6..8b6778e32b 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -22032,7 +22032,6 @@ Roo.data.DataReader.prototype = { case 'date' : da[c.name] = new Date(); break; case 'float' : da[c.name] = 0.0; break; case 'boolean' : da[c.name] = false; break; - case 'array' : da[c.name] = []; break; default : da[c.name] = ""; break; } diff --git a/roojs-ui-debug.js b/roojs-ui-debug.js index ca54376f30..468bfa7628 100644 --- a/roojs-ui-debug.js +++ b/roojs-ui-debug.js @@ -5646,7 +5646,6 @@ Roo.data.DataReader.prototype = { case 'date' : da[c.name] = new Date(); break; case 'float' : da[c.name] = 0.0; break; case 'boolean' : da[c.name] = false; break; - case 'array' : da[c.name] = []; break; default : da[c.name] = ""; break; } diff --git a/roojs-ui.js b/roojs-ui.js index 2f3d91a557..345ab7b2b7 100644 --- a/roojs-ui.js +++ b/roojs-ui.js @@ -103,7 +103,7 @@ Roo.data.Field=function(A){if(typeof A=="string"){A={name:A};} Roo.apply(this,A);if(!this.type){this.type="auto";}var st=Roo.data.SortTypes;if(typeof this.sortType=="string"){this.sortType=st[this.sortType];}if(!this.sortType){switch(this.type){case "string":this.sortType=st.asUCString;break;case "date":this.sortType=st.asDate;break;default:this.sortType=st.none;}}var B=/[\$,%]/g;if(!this.convert){var cv,C=this.dateFormat;switch(this.type){case "":case "auto":case undefined:cv=function(v){return v;};break;case "string":cv=function(v){return (v===undefined||v===null)?'':String(v);};break;case "int":cv=function(v){return v!==undefined&&v!==null&&v!==''?parseInt(String(v).replace(B,""),10):'';};break;case "float":cv=function(v){return v!==undefined&&v!==null&&v!==''?parseFloat(String(v).replace(B,""),10):'';};break;case "bool":case "boolean":cv=function(v){return v===true||v==="true"||v==1;};break;case "date":cv=function(v){if(!v){return '';}if(v instanceof Date){return v;}if(C){if(C=="timestamp"){return new Date(v*1000);}return Date.parseDate(v,C);}var D=Date.parse(v);return D?new Date(D):null;};break;} this.convert=cv;}};Roo.data.Field.prototype={dateFormat:null,defaultValue:"",mapping:null,sortType:null,sortDir:"ASC"}; //Roo/data/DataReader.js -Roo.data.DataReader=function(A,B){this.meta=A;this.recordType=B instanceof Array?Roo.data.Record.create(B):B;};Roo.data.DataReader.prototype={newRow:function(d){var da={};this.recordType.prototype.fields.each(function(c){switch(c.type){case 'int':da[c.name]=0;break;case 'date':da[c.name]=new Date();break;case 'float':da[c.name]=0.0;break;case 'boolean':da[c.name]=false;break;case 'array':da[c.name]=[];break;default:da[c.name]="";break;}});return new this.recordType(Roo.apply(da,d));}}; +Roo.data.DataReader=function(A,B){this.meta=A;this.recordType=B instanceof Array?Roo.data.Record.create(B):B;};Roo.data.DataReader.prototype={newRow:function(d){var da={};this.recordType.prototype.fields.each(function(c){switch(c.type){case 'int':da[c.name]=0;break;case 'date':da[c.name]=new Date();break;case 'float':da[c.name]=0.0;break;case 'boolean':da[c.name]=false;break;default:da[c.name]="";break;}});return new this.recordType(Roo.apply(da,d));}}; //Roo/data/DataProxy.js Roo.data.DataProxy=function(){this.addEvents({beforeload:true,load:true,loadexception:true});Roo.data.DataProxy.superclass.constructor.call(this);};Roo.extend(Roo.data.DataProxy,Roo.util.Observable); //Roo/data/MemoryProxy.js