Results 1 to 3 of 3

Thread: Nested JSON data in a form with DirectEXTJS

  1. #1
    Sencha User
    Join Date
    Feb 2011
    Location
    Belgium
    Posts
    28

    Default Nested JSON data in a form with DirectEXTJS

    Hi ,

    When I load my form I have a JSON object with another json object in it.

    Code:
    "data": {
          "TicketId": 1,
          "Description": "%3Cfont%20size=%223%22%3EKapotte%20Router%3Cbr%3E%3Cbr%3E+%20Nieuwe%20Kabels%20!%3Cbr%3E+%20nieuwe%20pc%20aub%3Cbr%3E%3C/font%3E",
          "Customer": null,
          "Engineer": {
            "EngineerId": 1,
            "FirstName": "sdfsdfsdfsf",
            "LastName": "sdfsdf",
            "Email": "[email protected]",
            "Status": false
          }
    Now I can't see to get to the Engineer Object from my data object into the form. I know you can use the 'mapping' function on fields. But since I'm using the directLoad I can't edit the fields and use mapping.

    Code:
    api: {
                    load: Ticket.GetTicketById,
                    submit: Ticket.UpdateTicketById
                },
    Any way to over come this and edit the fields while using the directLoad or any other method how I can get my nested JSON data working in my form??

    Many thanks

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    You could extend Ext.form.Action.DirectLoad and write your own processResponse method.

  3. #3
    Sencha User
    Join Date
    Feb 2011
    Location
    Belgium
    Posts
    28

    Default

    Thanks for the hint.
    I'll give it a look, I also found an other post of yours that might do the trick.

    It's from extJS2.x but still, shouldn't this do the trick aswell?

    formPanel.getForm().on('actioncomplete', function(form, action){
    if(action.type == 'load'){
    form.findField('YOURFIELDID).setValue(action.result.data.YOUPROPERTY);
    }
    });
    Edit:
    Yep this actually worked aswell. And it's a lot easier then writing my own processResponse method I think :p

    Thanks Condor!

Similar Threads

  1. Nested JSON Data Into Carousel
    By mrnap in forum Sencha Touch 1.x: Discussion
    Replies: 1
    Last Post: 20 Oct 2010, 11:00 PM
  2. Json Data, with nested array
    By Bleak in forum Ext 3.x: Help & Discussion
    Replies: 6
    Last Post: 8 Jul 2010, 6:42 AM
  3. How to post back data as nested JSON
    By elwhiz in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 6 May 2010, 6:59 PM
  4. JSonStore with nested json data
    By genio in forum Ext 2.x: Help & Discussion
    Replies: 32
    Last Post: 21 Jul 2009, 11:06 PM
  5. Ext 2.1: Accessing nested JSON data
    By John Sourcer in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 5 May 2008, 11:59 PM

Posting Permissions

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