PDA

View Full Version : Problem with JSON format while form.load()



navvn
5 Jan 2011, 12:25 AM
Hello
I,v made a grid that has listener:


rowselect: function(sm, index, record) {
var tempName = record.get('name');
var companyJsonId = record.get('com_id');
Ext.getCmp('CardForm').getForm().load({
url:'/companies/getcompany'
,params:
{
id: companyJsonId
}
JSON source supose to be like:

INPUT NAME eq JSON NAME



{-
data: {

com_id: 1002
name: "Companyname"
status: "E"
channels: [

id: 8
com_id: 1002
domain: "klient.company.pl"
channel: "WEB:CUS"
createdon: "2010-10-23 09:36:09.420409"



Is it possible to load channels array in json source to form using extjs api? I don't want to use jquery getjson.

regards

navvn
5 Jan 2011, 1:50 AM
well i read a little how to solve this. Basicly in success callback while doing form.load i want to use something like:



Ext.each(data.channels, function(chan){
Ext.get('channelCompany').set({value:chan.WEB)};
}, this);


but how can i turn to json data in success callback? In failure i use:



,failure: function(form, action) {
Ext.Msg.show({
title: 'Uwaga!'
,msg: 'Wyst?pi? b??d.<br />Komunikat: '+data.errormsg+'<br />Numer b??du: '+data.errorcode+''
,icon: Ext.MessageBox.ERROR
,buttons: Ext.MessageBox.OK
});
myCardMask.hide();
}


and data. works as intended.