-
12 Jun 2009 12:16 AM #1
[CLOSED][3.0 CORE] Ext core still have problems with json encode
[CLOSED][3.0 CORE] Ext core still have problems with json encode
Ext core still have problems with json encode function. I believe that Ext.isDate is missing.
The Ext.encode returns the following error: TypeError: Ext.isDate is not a function.
-
12 Jun 2009 12:23 AM #2
Which version? isDate doesn't appear in the SVN version of Ext core anywhere.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
12 Jun 2009 1:08 AM #3
Just go to http://extjs.com/playpen/ext-core-la...amples/rating/
And type the following into the Firebug console:
Code:Ext.util.JSON.encode({d: new Date()})Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
12 Jun 2009 1:28 AM #4
This is odd, the core code doesn't contain anything to do with isDate, perhaps something is weird with the build script.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
12 Jun 2009 1:37 AM #5
trunk/src/core/util/JSON.js:
Code:this.encode = function(o){ if(typeof o == "undefined" || o === null){ return "null"; }else if(Ext.isArray(o)){ return encodeArray(o); }else if(Ext.isDate(o)){ return Ext.util.JSON.encodeDate(o);Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
12 Jun 2009 1:39 AM #6
Not what I'm seeing:
Code:this.encode = isNative ? JSON.stringify : function(o){ if(typeof o == "undefined" || o === null){ return "null"; }else if(Ext.isArray(o)){ return encodeArray(o); }else if(Object.prototype.toString.apply(o) === '[object Date]'){ return Ext.util.JSON.encodeDate(o);Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
12 Jun 2009 1:40 AM #7
Of course the obvious answer is just include isDate() in core, since the code saving from not including it is relatively minor.
Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
-
12 Jun 2009 1:42 AM #8
OK, the build was wrong.
Because on that test page, Ext.util.JSON.encode.toSource() prints
Code:"(function (o) {if (typeof o == "undefined" || o === null) {return "null";} else if (Ext.isArray(o)) {return encodeArray(o);} else if (Ext.isDate(o)) {return Ext.util.JSON.encodeDate(o);} else if (typeof o == "string") {return encodeString(o);} else if (typeof o == "number") {return isFinite(o) ? String(o) : "null";} else if (typeof o == "boolean") {return String(o);} else {var a = ["{"], b, i, v;for (i in o) {if (!useHasOwn || o.hasOwnProperty(i)) {v = o[i];switch (typeof v) {case "undefined":case "function":case "unknown":break;default:if (b) {a.push(",");}a.push(this.encode(i), ":", v === null ? "null" : this.encode(v));b = true;}}}a.push("}");return a.join("");}})"Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
12 Jun 2009 1:45 AM #9
Something's funny with SVN.
I just explicitly did an SVN Update on trunk/core/src/util, and it updated JSON.js with the code fix that Tommy put in on the 2nd.
That was after I did an SVN Update on the whole ext directory earlier today.
Could be that when the build is done, the SVN checkout is not working well.Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
12 Jun 2009 2:08 AM #10
the <ext>/core directory is marked as an external svn resource, so it won't be updated when updating <ext>. you'll need to explicitly update <ext>/core (using tortoisesvn / command line) to get the latest core.
Sencha Docs / Ext 3.x - ( Docs | Examples )
Learning Center / Saki's Examples (for 2.x) / HOWTO - ( Report Bugs | Post Proper Code )
Thank you for reporting this bug. We will make it our priority to review this report.


Reply With Quote