我是 ext Js 的新手。
我有一个ajax调用。我可以在警报上看到响应文本,但假设对 responseText 进行解码的下一行不会在警报框中产生任何结果。
我的功能是这样的:
function openToRecipients()
{
Ext.Ajax.request({
url: "Redirector?id=ClinicalInitiateForm&wfid=CLINICALONGOINGWFINITIATE",
method: 'POST',
success: function(response, opts)
{
alert(response.responseText);
var dataCurrent = Ext.util.JSON.decode(response.responseText);
alert(dataCurrent );
var jsonStr = dataCurrent.cData;
recipientJsonResponse = dataCurrent.dataGrid;
var myObject = eval('(' + jsonStr + ')');
gridStore = new Ext.data.JsonStore({
id : 'gridStore',
autoLoad : true,
data : myObject,
root : 'data',
fields:['NAME',
'CLIENT',
'DESCRIPTION'
],
listeners :{
load : gridDisplay
}
});
},
failure: function(response, opts) {
alert("fail");
}
});
}
这是我转换为字符串后的 json
"formFields" : [ {
"id" : "NAME",
"set" : "",
"label" : "Name",
"dataType" : "string",
"editType" : "static",
"clientConfig" : "",
"hide" : "False",
"required" : "",
"mask" : "",
"maxValue" : "",
"maxLength" : "",
"minValue" : "",
"value" : "",
"showIf" : "",
"options" : "",
"prePopulate" : "",
"shortForm" : "",
"comments" : "",
"optionsValue" : "",
"currentValue" : "",
"disabled" : "",
"qTip" : "",
"hover" : ""
}, {
"id" : "CLIENT",
"set" : "",
"label" : "Client",
"dataType" : "string",
"editType" : "static",
"clientConfig" : "",
"hide" : "False",
"required" : "",
"mask" : "",
"maxValue" : "",
"maxLength" : "",
"minValue" : "",
"value" : "",
"showIf" : "",
"options" : "",
"prePopulate" : "",
"shortForm" : "",
"comments" : "",
"optionsValue" : "",
"currentValue" : "",
"disabled" : "",
"qTip" : "",
"hover" : ""
}, {
"id" : "DESCRIPTION",
"set" : "",
"label" : "Description",
"dataType" : "string",
"editType" : "static",
"clientConfig" : "",
"hide" : "False",
"required" : "",
"mask" : "",
"maxValue" : "",
"maxLength" : "",
"minValue" : "",
"value" : "",
"showIf" : "",
"options" : "",
"prePopulate" : "",
"shortForm" : "",
"comments" : "",
"optionsValue" : "",
"currentValue" : "",
"disabled" : "",
"qTip" : "",
"hover" : ""
} ],
这是我的数据
{'data':[{"NAME":"Shan","CLIENT":"CSC","DESCRIPTION":"Computer science"}]}
我怎样才能在我的网格中拥有这些数据