1. #1
    Sencha User thejoker101's Avatar
    Join Date
    Mar 2007
    Posts
    348
    Vote Rating
    0
    thejoker101 is on a distinguished road

      0  

    Default Json Encoding in Provider

    Json Encoding in Provider


    Why does the Provider class always encode/decode values as JSON? I know this is necessary for the default CookieProvider, but shouldn't it be in the CookieProvider class, as opposed to the base Provider class? Is there a reason this is done this way?

  2. #2
    Ext JS Premium Member
    Join Date
    Oct 2009
    Location
    Cambridge, MA
    Posts
    36
    Vote Rating
    2
    hjones is on a distinguished road

      0  

    Default


    I don't think it is doing a JSON encode in the provider.

    The encodeValue function are converting the state object(s) in to an encoded string format that isn't JSON. The resulting string is escaped and state object type information encoded within (in an abbreviated fashion) - perhaps someone else can answer why this approach rather than JSON - but it looks to me like it is optimal for the restricted storage of a cookie?

  3. #3
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,756
    Vote Rating
    113
    sven is just really nice sven is just really nice sven is just really nice sven is just really nice sven is just really nice

      0  

    Default


    hjones, in extjs it is probably not using json. In GXT however we use json. We even use the json methods comming from GWT.


    thejoker101, you can extend Provider (create an own one) that does not use json. You can use anything you can store somewhere.