我正在使用ExtJS,我使用SOAPClient进行了服务调用:
var url2 = "https://serviceUrlGoesHere/MyService";
var pl = new SOAPClientParameters();
pl.add("arg0", false);
SOAPClient.invoke(url2, "getPaymentsMethod", pl, true, getDataCallback);
我的回复方法:
function getDataCallback(response) {
???
};
以下是服务回复:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<dlwmin:getPaymentsMethod xmlns:dlwmin="http://blahblah.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<return>
<contents>
<eftAcctNo>501014635986</eftAcctNo>
<eftAcctRoutNo>122400724</eftAcctRoutNo>
</contents>
<contents>
<eftAcctNo></eftAcctNo>
<eftAcctRoutNo></eftAcctRoutNo>
</contents>
<contents>
<eftAcctNo></eftAcctNo>
<eftAcctRoutNo></eftAcctRoutNo>
</contents>
<status>0</status>
</return>
</dlwmin:getPaymentsMethod>
</soapenv:Body>
</soapenv:Envelope>
我的问题是......如何将此数据添加到模型并填充dataGrid?
答案 0 :(得分:0)
以下是如何加载商店的示例,在此之后填充数据网格应该非常简单,因为您可以在网站上处理其中一个示例:
Ext.define("YourModel", {
extend: "Ext.data.Model",
fields: [
{name:"eftAcctNo", type:"int"},
{name:"eftAcctRoutNo", type:"int"}
]
});
var store = Ext.create('Ext.data.Store', {
autoLoad: false,
model: 'YourModel',
proxy: {
type: 'memory',
reader: {
type: 'xml',
root: 'return'
}
}
});
function getDataCallback(response) {
store.loadData(response.reponseText);// or just response if that is already text in your case
};
答案 1 :(得分:0)
以下是对我有用的答案:
var url2 = "https://serviceUrlGoesHere/MyService";
var pl = new SOAPClientParameters();
pl.add("arg0", false);
SOAPClient.invoke(url2, "getPaymentsMethod", pl, true, this.getDataCallback);
getDataCallback: function (req, r) {
var store = Ext.getStore('STORENAMEHERE');
store.loadRawData(r);
store.sync();
}
通过执行loadRawData,它将数据加载到Store中,我的Grid能够成功加载数据。