From: john Date: Fri, 11 May 2018 03:49:26 +0000 (+0800) Subject: Roo/data/JsonReader.js X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=cf55d5c7d44f24bf2ed5a0a3ae7dc453d4690f61 Roo/data/JsonReader.js roojs-bootstrap.js roojs-bootstrap-debug.js --- diff --git a/Roo/data/JsonReader.js b/Roo/data/JsonReader.js index 361b361ecc..17ae6b4c3b 100644 --- a/Roo/data/JsonReader.js +++ b/Roo/data/JsonReader.js @@ -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) { diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 8c7fee539e..5df01649e5 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -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]; diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index c938cb321b..8a98fad811 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -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