Ext.decode instead of local eval

January 6th, 2009
  • At several places in the code the eval function is called. Can you change the code of the the functions to call Ext.decode (so you can override the decode function).. in my case the value is already an object and redecoding raises an error..

    JsonReader
    read : function(response){
    var json = response.responseText;
    var o = Ext.decode(json);

    JsonView:
    render:
    o = Ext.util.JSON.decode(response.responseText);
    if(this.jsonRoot){
    o = eval("o." + this.jsonRoot);
    }

    TreeLoader
    processResponse:
    var o = eval("("+json+")");

    Thanks
    Marco


  • Actually they should all be using eval so there is no dependency on the JSON file. It should only be required if you want to encode JSON. ;)


  • Sorry Marco. Can I ask why you need to rewrite the responseText with an Object?


  • I somewhat expected this answer .. I will use a workaround.

    Thanks
    Marco


  • I'm using a server side framework (jayrock (something like AjaxPro) to communicate between the client and my asp.net website. These frameworks always return a json string. The results is an object with a result or an error property. I'm using a interceptor at handleResponse to decode the result and only assign the result property to the response.responseText..

    see this post http://extjs.com/forum/showthread.php?p=47562

    but then it's already an object and not a string anymore.. for now i'm just encoding the result object again..

    Thanks
    Marco







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about Ext.decode instead of local eval , Please add it free.