Roo/data/JsonReader.js
authorjohn <john@roojs.com>
Fri, 11 May 2018 03:49:26 +0000 (11:49 +0800)
committerjohn <john@roojs.com>
Fri, 11 May 2018 03:49:26 +0000 (11:49 +0800)
roojs-bootstrap.js
roojs-bootstrap-debug.js

Roo/data/JsonReader.js
roojs-bootstrap-debug.js
roojs-bootstrap.js

index 361b361..17ae6b4 100644 (file)
@@ -144,6 +144,12 @@ Roo.extend(Roo.data.JsonReader, Roo.data.DataReader, {
         var s = this.meta, Record = this.recordType,
             f = Record ? Record.prototype.fields : null, fi = f ? f.items : [], fl = f ? f.length : 0;
 
+        Roo.log('----------------------');
+        Roo.log(s);
+        Roo.log(Record);
+        Roo.log(f);
+
+
 //      Generate extraction functions for the totalProperty, the root, the id, and for each field
         if (!this.ef) {
             if(s.totalProperty) {
index 8c7fee5..5df0164 100644 (file)
@@ -12271,6 +12271,12 @@ Roo.extend(Roo.data.JsonReader, Roo.data.DataReader, {
         var s = this.meta, Record = this.recordType,
             f = Record ? Record.prototype.fields : null, fi = f ? f.items : [], fl = f ? f.length : 0;
 
+        Roo.log('----------------------');
+        Roo.log(s);
+        Roo.log(Record);
+        Roo.log(f);
+
+
 //      Generate extraction functions for the totalProperty, the root, the id, and for each field
         if (!this.ef) {
             if(s.totalProperty) {
@@ -12310,11 +12316,6 @@ Roo.extend(Roo.data.JsonReader, Roo.data.DataReader, {
                 success = false;
             }
         }
-        
-        
-        Roo.log('--------------------------');
-        Roo.log(root);
-        
         var records = [];
         for(var i = 0; i < c; i++){
                 var n = root[i];
index c938cb3..8a98fad 100644 (file)
@@ -491,10 +491,10 @@ A.callback.call(A.scope||window,B,A.arg,true);},handleFailure:function(A){this.t
 Roo.data.JsonReader=function(A,B){A=A||{};Roo.applyIf(A,{totalProperty:'total',successProperty:'success',root:'data',id:'id'});Roo.data.JsonReader.superclass.constructor.call(this,A,B||A.fields);};Roo.extend(Roo.data.JsonReader,Roo.data.DataReader,{metaFromRemote:false,read:function(A){var B=A.responseText;
 var o=eval("("+B+")");if(!o){throw {message:"JsonReader.read: Json object not found"};}if(o.metaData){delete this.ef;this.metaFromRemote=true;this.meta=o.metaData;this.recordType=Roo.data.Record.create(o.metaData.fields);this.onMetaChange(this.meta,this.recordType,o);
 }return this.readRecords(o);},onMetaChange:function(A,B,o){},simpleAccess:function(A,B){return A[B];},getJsonAccessor:function(){var re=/[\[\.]/;return function(A){try{return (re.test(A))?new Function("obj","return obj."+A):function(B){return B[A];};}catch(e){}
-return Roo.emptyFn;};}(),readRecords:function(o){this.o=o;var s=this.meta,A=this.recordType,f=A?A.prototype.fields:null,fi=f?f.items:[],fl=f?f.length:0;if(!this.ef){if(s.totalProperty){this.getTotal=this.getJsonAccessor(s.totalProperty);}if(s.successProperty){this.getSuccess=this.getJsonAccessor(s.successProperty);
-}this.getRoot=s.root?this.getJsonAccessor(s.root):function(p){return p;};if(s.id){var g=this.getJsonAccessor(s.id);this.getId=function(I){var r=g(I);return (r===undefined||r==="")?null:r;};}else{this.getId=function(){return null;};}this.ef=[];for(var jj=0;
-jj<fl;jj++){f=fi[jj];var B=(f.mapping!==undefined&&f.mapping!==null)?f.mapping:f.name;this.ef[jj]=this.getJsonAccessor(B);}}var C=this.getRoot(o),c=C.length,D=c,E=true;if(s.totalProperty){var vt=parseInt(this.getTotal(o),10);if(!isNaN(vt)){D=vt;}}if(s.successProperty){var vs=this.getSuccess(o);
-if(vs===false||vs==='false'){E=false;}}Roo.log('--------------------------');Roo.log(C);var F=[];for(var i=0;i<c;i++){var n=C[i];var G={};var id=this.getId(n);for(var j=0;j<fl;j++){f=fi[j];var v=this.ef[j](n);if(!f.convert){Roo.log('missing convert for '+f.name);
+return Roo.emptyFn;};}(),readRecords:function(o){this.o=o;var s=this.meta,A=this.recordType,f=A?A.prototype.fields:null,fi=f?f.items:[],fl=f?f.length:0;Roo.log('----------------------');Roo.log(s);Roo.log(A);Roo.log(f);if(!this.ef){if(s.totalProperty){this.getTotal=this.getJsonAccessor(s.totalProperty);
+}if(s.successProperty){this.getSuccess=this.getJsonAccessor(s.successProperty);}this.getRoot=s.root?this.getJsonAccessor(s.root):function(p){return p;};if(s.id){var g=this.getJsonAccessor(s.id);this.getId=function(I){var r=g(I);return (r===undefined||r==="")?null:r;
+};}else{this.getId=function(){return null;};}this.ef=[];for(var jj=0;jj<fl;jj++){f=fi[jj];var B=(f.mapping!==undefined&&f.mapping!==null)?f.mapping:f.name;this.ef[jj]=this.getJsonAccessor(B);}}var C=this.getRoot(o),c=C.length,D=c,E=true;if(s.totalProperty){var vt=parseInt(this.getTotal(o),10);
+if(!isNaN(vt)){D=vt;}}if(s.successProperty){var vs=this.getSuccess(o);if(vs===false||vs==='false'){E=false;}}var F=[];for(var i=0;i<c;i++){var n=C[i];var G={};var id=this.getId(n);for(var j=0;j<fl;j++){f=fi[j];var v=this.ef[j](n);if(!f.convert){Roo.log('missing convert for '+f.name);
 Roo.log(f);continue;}G[f.name]=f.convert((v!==undefined)?v:f.defaultValue);}var H=new A(G,id);H.json=n;F[i]=H;}return {raw:o,success:E,records:F,totalRecords:D};}});
 // Roo/data/ArrayReader.js
 Roo.data.ArrayReader=function(A,B){Roo.data.ArrayReader.superclass.constructor.call(this,A,B);};Roo.extend(Roo.data.ArrayReader,Roo.data.JsonReader,{readRecords:function(o){var A=this.meta?this.meta.id:null;var B=this.recordType,C=B.prototype.fields;var D=[];