X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..530ef4b6c5b943cfa68b779d11cf7de29aa878bf:/pkgs/data-json.js?ds=sidebyside diff --git a/pkgs/data-json.js b/pkgs/data-json.js index 35d72a35..35197efb 100644 --- a/pkgs/data-json.js +++ b/pkgs/data-json.js @@ -1,7 +1,7 @@ /* - * Ext JS Library 3.0.0 - * Copyright(c) 2006-2009 Ext JS, LLC + * Ext JS Library 3.2.1 + * Copyright(c) 2006-2010 Ext JS, Inc. * licensing@extjs.com * http://www.extjs.com/license */ -Ext.data.JsonWriter=function(a){Ext.data.JsonWriter.superclass.constructor.call(this,a);if(this.returnJson!=undefined){this.encode=this.returnJson}};Ext.extend(Ext.data.JsonWriter,Ext.data.DataWriter,{returnJson:undefined,encode:true,render:function(c,a,d,b){Ext.apply(d,b);if(this.encode===true){if(Ext.isArray(a)&&b[this.meta.idProperty]){d[this.meta.idProperty]=Ext.encode(d[this.meta.idProperty])}d[this.meta.root]=Ext.encode(d[this.meta.root])}},createRecord:function(a){return this.toHash(a)},updateRecord:function(a){return this.toHash(a)},destroyRecord:function(a){return a.id}});Ext.data.JsonReader=function(a,b){a=a||{};Ext.applyIf(a,{idProperty:"id",successProperty:"success",totalProperty:"total"});Ext.data.JsonReader.superclass.constructor.call(this,a,b||a.fields)};Ext.extend(Ext.data.JsonReader,Ext.data.DataReader,{read:function(a){var b=a.responseText;var c=Ext.decode(b);if(!c){throw {message:"JsonReader.read: Json object not found"}}return this.readRecords(c)},onMetaChange:function(a,c,b){},simpleAccess:function(b,a){return b[a]},getJsonAccessor:function(){var a=/[\[\.]/;return function(c){try{return(a.test(c))?new Function("obj","return obj."+c):function(d){return d[c]}}catch(b){}return Ext.emptyFn}}(),readRecords:function(a){this.jsonData=a;if(a.metaData){delete this.ef;this.meta=a.metaData;this.recordType=Ext.data.Record.create(a.metaData.fields);this.onMetaChange(this.meta,this.recordType,a)}var u=this.meta,m=this.recordType,h=m.prototype.fields,t=h.items,p=h.length,q;this.buildExtractors();var l=this.getRoot(a),k=l.length,j=k,r=true;if(u.totalProperty){q=parseInt(this.getTotal(a),10);if(!isNaN(q)){j=q}}if(u.successProperty){q=this.getSuccess(a);if(q===false||q==="false"){r=false}}var d=[];for(var e=0;e=0){return new Function("obj","return obj"+(b>0?".":"")+c)}return function(d){return d[c]}}}(),extractValues:function(h,d,a){var g,c={};for(var e=0;e