X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6e39d509471fe9b4e2660e0d1631b350d0c66f40..2e847cf21b8ab9d15fa167b315ca5b2fa92638fc:/src/data/JsonReader.js diff --git a/src/data/JsonReader.js b/src/data/JsonReader.js index 03c3be99..3da7fbb6 100644 --- a/src/data/JsonReader.js +++ b/src/data/JsonReader.js @@ -1,6 +1,6 @@ /*! - * Ext JS Library 3.1.0 - * Copyright(c) 2006-2009 Ext JS, LLC + * Ext JS Library 3.1.1 + * Copyright(c) 2006-2010 Ext JS, LLC * licensing@extjs.com * http://www.extjs.com/license */ @@ -298,14 +298,20 @@ Ext.extend(Ext.data.JsonReader, Ext.data.DataReader, { createAccessor : function(){ var re = /[\[\.]/; return function(expr) { - try { - return(re.test(expr)) ? - new Function('obj', 'return obj.' + expr) : - function(obj){ - return obj[expr]; - }; - } catch(e){} - return Ext.emptyFn; + if(Ext.isEmpty(expr)){ + return Ext.emptyFn; + } + if(Ext.isFunction(expr)){ + return expr; + } + var i = String(expr).search(re); + if(i >= 0){ + return new Function('obj', 'return obj' + (i > 0 ? '.' : '') + expr); + } + return function(obj){ + return obj[expr]; + }; + }; }(),