Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am using ExtJS and I made a service call using SOAPClient as such:

var url2 = "https://serviceUrlGoesHere/MyService";

var pl = new SOAPClientParameters();    
pl.add("arg0", false);

SOAPClient.invoke(url2, "getPaymentsMethod", pl, true, getDataCallback);

My response method:

function getDataCallback(response) {
    ???
};

Here is the service 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>

My question is... how do I add this data to a model and populate a dataGrid?

share|improve this question
1  
Attach an XML Reader to your Store, and load your data afterwards. –  Gregor Jul 12 '13 at 20:06
add comment

2 Answers

Here is an example of how to load a store, populating a data grid should be pretty simple after this because you can work off one of the examples on the site:

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
};
share|improve this answer
    
You want to dynamically create a store and model based on what's in the returned data? –  Reimius Jul 12 '13 at 21:36
    
I can try it this way but I would also like to know how dynamically. I appreciate your help. –  anad2312 Jul 12 '13 at 22:09
    
This is the recommended way from Extjs. Dynamic creation based on returned data would take a lot of skill to be done completely accurate. –  Reimius Jul 12 '13 at 22:19
    
Ok Thanks. I am a Flex Dev so I am trying to figure this stuff out. –  anad2312 Jul 12 '13 at 23:26
    
I get the following error: Uncaught TypeError: Object [object global] has no method 'loadData' PhoneCalls.js?_dc=1373675313519:23 getDataCallback –  anad2312 Jul 13 '13 at 0:31
show 5 more comments
up vote 0 down vote accepted

Here is the answer that worked for me:

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();
}

By doing a loadRawData, it loaded the data into the Store and my Grid was able to load the data successfully.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.