PDA

View Full Version : Problem with the data load into form



suryanarendra
24 May 2012, 10:06 AM
Hi,

I have a problem with loading data into form. I have a popup window with the form.
I am using a model class along with store to load data.

Model class properties are:

{id},
{name},
{replication.name}

In Controller am loading data into form using store:

store.getProxy().url = 'xxx';
store.load({
callback:function (records, options, success) {
if (success) {
var record = records[0],
popup.down('form').loadRecord(record);
}
}
});

view:
-----
items:[
{
xtype:'textfield',
fieldLabel:'id',
name:'id'
},
{
xtype:'textfield',
fieldLabel:'name',
name:'lunName'
},
{
xtype:'textfield',
fieldLabel:'replicated name',
name:'replication.name'
}
]

JSON response:

{
success: true,
data: [
id: "148912",
name:"xxxx",
replication: {
name: "ABCD"
}
]
total:1
}

Now the problem is some times replication object in JSON response coming as null from database query. At that time my popup window is not getting displayed and it is saying replication value is null and it can't load replication.name value.

Can someone help me how can I get rid of this situation by not changing model class ?

mitchellsimoens
26 May 2012, 4:00 AM
I would use a simple name for both the form field and model field instead of an object notation. You can use mapping or the convert configs of the model field.

suryanarendra
30 May 2012, 3:28 PM
Thank you :)

It solved my problem.