Results 1 to 2 of 2

Thread: JSON, Model and Fields - how to get a custom serialized field JSON encoded string ?

  1. #1
    Sencha Premium Member
    Join Date
    Sep 2014
    Posts
    81
    Answers
    1

    Default Answered: JSON, Model and Fields - how to get a custom serialized field JSON encoded string ?

    I've a model with some date fields defined - together with my own serialize methods. Below is an example of these date fields within the model.

    {
    name: 'fromTS',
    type: 'date',
    serialize:
    function(v, record) { return Ext.isDate(v) ? Ext.Date.format(v, 'Y-m-d') : null; }
    }
    Now I have an instance of this model and I would like to get the JSON string of this instance and I would like to have the defined serialize methods called ...

    I tried to use
    Ext.JSON.encode(anInstance.getData())

    but this delivers "only" the JSON structure without calling the serialize methods.

    How is this done correctly ????

  2. i found the answer (grrrr...):

    anInstance.getData({serialize:true})

    ....

  3. #2
    Sencha Premium Member
    Join Date
    Sep 2014
    Posts
    81
    Answers
    1

    Default

    i found the answer (grrrr...):

    anInstance.getData({serialize:true})

    ....

Similar Threads

  1. JSON (String) to Model
    By CristianCruz in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 9 May 2013, 9:02 AM
  2. Json string gets encoded twice?
    By Maze in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 7 Feb 2008, 11:15 AM

Posting Permissions

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