The method:
Ext.Ajax.request({
url: 'url',
method: 'GET',
timeout: 60000,
params: {
"perviceTypeId": my.rec.data.prepeId
},
success: function(response) {
var jsonResp = response.responseText;
console.log("ajax data responseText::" + jsonResp);
//how to parse value and display and populate to deageType combobox
var combo = Ext.getCmp('deageType');
}
});
The response is JSON:
{
"message": null,
"data": [
{
"value": "ESS",
"display": "ESS"
},
{
"value": "ANS",
"display": "ANS"
}
],
"errorCode": -1,
"totalCount": 1,
"messages": null,
"resultDate": 1615282701392,
"success": true
}
You can do that:
var combo = Ext.getCmp('myCombo');
combo.store = Ext.create('Ext.data.Store', {
fields: ['value', 'display'],
data: responseJSON.data
});
Here is functional fiddle with that example: https://fiddle.sencha.com/#view/editor&fiddle/3cb0
You should decode the response (using Ext.JSON.decode
) and bind the store (using bindStore
) to combo:
Example:
Ext.Ajax.request({
url: 'url',
method: 'GET',
timeout: 60000,
params: {
"perviceTypeId": my.rec.data.prepeId
},
success: function(response) {
var jsonResp = Ext.JSON.decode(response.responseText);
var combo = Ext.getCmp('deageType');
combo.bindStore(Ext.create('Ext.data.Store', {
fields: ['display', 'value'],
data: jsonResp['data']
}));
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.