View Full Version : Nested JSON data in a form with DirectEXTJS

24 Feb 2011, 4:11 AM
Hi ,

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

"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": "sdfsdfsdfsdf@telenet.be",
"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.

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

24 Feb 2011, 4:24 AM
You could extend Ext.form.Action.DirectLoad and write your own processResponse method.

24 Feb 2011, 4:26 AM
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'){

Yep this actually worked aswell. And it's a lot easier then writing my own processResponse method I think :p

Thanks Condor!