Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext User
    Join Date
    Dec 2007
    Posts
    1
    Vote Rating
    0
    christianjianelli is on a distinguished road

      0  

    Default [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.

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,648
    Vote Rating
    583
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    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!

  3. #3
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,496
    Vote Rating
    44
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    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()})

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,648
    Vote Rating
    583
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    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!

  5. #5
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,496
    Vote Rating
    44
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    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);

  6. #6
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,648
    Vote Rating
    583
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    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!

  7. #7
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,648
    Vote Rating
    583
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    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!

  8. #8
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,496
    Vote Rating
    44
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    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("");}})"

  9. #9
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,496
    Vote Rating
    44
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    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.

  10. #10
    Sencha - Community Support Team mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
    mystix will become famous soon enough

      0  

    Default


    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.

Thread Participants: 3