Reputation: 4980
I have a simple form. The returning json value from the server like below:
{
"success":true,
"data":{
"DNR_ID":"9",
"DNR_TYPE_ID":"1",
"DNR_DEF_ID":"1",
"DNR_DESC":"PROCTOR & GAMBLE HAFTASONU AKSIYONU",
"STORES": {
"0" => "ANKARA"
"1" => "ISTANBUL"
}
}
}
As you can see, there is an array inside the data
which is STORES
. So, what I want to do, put those values into textarea that available in the form.
The ExtJS simple form mechanism didn't work.
listeners: {
select: function() {
if (this.getSelectionModel().hasSelection()) {
var row = this.getSelectionModel().getSelection()[0];
Ext.getCmp('dnr-list-info').getForm().load({
url: '<?php echo base_url() ?>/list/get_dnr_info',
params: {dnrid: row.get('DNR_ID')},
method: 'GET',
success: function(res) {
// In fact, this line doesn't necessary because form load function automatically fill the form
Ext.getCmp('dnr-list-info').getForm().setValues(res);
}
});
}
}
}
Upvotes: 1
Views: 735
Reputation: 4355
You need to go down
to the textarea component and setValue
there.
myForm.down('#itemIdForTextArea').setValue('myValue');
or you can directly query the textarea by item id as well...
Ext.ComponentQuery.query('#itemIdForTextArea')[0].setValue('myValue');
or id..
Ext.getCmp('idForTextArea').setValue('myValue');
More info available in sencha docs
Upvotes: 1