Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: [CLOSED][3.0 CORE] Ext core still have problems with json encode

    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
      0  

    Default [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 User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    18,965
    Vote Rating
    931
      0  

    Default

    Which version? isDate doesn't appear in the SVN version of Ext core anywhere.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3
    Sencha - Community Support Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Redwood City
    Posts
    30,748
    Vote Rating
    80
      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()})
    Longtime Sencha engineer. Now surplus to requirements apparently...

  4. #4
    Sencha User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    18,965
    Vote Rating
    931
      0  

    Default

    This is odd, the core code doesn't contain anything to do with isDate, perhaps something is weird with the build script.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  5. #5
    Sencha - Community Support Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Redwood City
    Posts
    30,748
    Vote Rating
    80
      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);
    Longtime Sencha engineer. Now surplus to requirements apparently...

  6. #6
    Sencha User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    18,965
    Vote Rating
    931
      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);
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  7. #7
    Sencha User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    18,965
    Vote Rating
    931
      0  

    Default

    Of course the obvious answer is just include isDate() in core, since the code saving from not including it is relatively minor.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  8. #8
    Sencha - Community Support Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Redwood City
    Posts
    30,748
    Vote Rating
    80
      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("");}})"
    Longtime Sencha engineer. Now surplus to requirements apparently...

  9. #9
    Sencha - Community Support Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Redwood City
    Posts
    30,748
    Vote Rating
    80
      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.
    Longtime Sencha engineer. Now surplus to requirements apparently...

  10. #10
    Sencha User mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
      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.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •