View Full Version : Posting XML Documents from multiple stores?

4 Jan 2011, 11:10 AM

Sorry if this is a dumb question, I am new very new to ExtJS, and trying to create a page using XMLStore to perform read/write operations to a back end.

I seem to have this working for a very basic document, i.e. one that contains only a single record type. But I am hoping to be able to post more complex documents. For example
<Invoice customer="My Customer" date="2011-01-04">
<Line product="ProductA" quantity="1" price="5.99"/>
<Line product="ProductB" quantity="2" price="7.99"/>

Obviously, I can create two stores, invoiceStore, and invoiceLineItemStore, and the display and editting process would work fine, but it makes no sense to post these seperately to the back end, which is restful i.e. maintains no state.

Is there a simple way to store an xml like the one above in some form of store(s) for editting, and then post the modified document back to the server? Or would I need to write code to manually reconstruct the entire document from multiple stores? Any advice appreciated!


4 Jan 2011, 12:50 PM
have you look at this example?


4 Jan 2011, 1:26 PM
Hi Mark,

Thanks for the input. Maybe I am missing something, but I do not quite see how this one addresses the problem. It appears to load and display a single xml file, with a single "record type" in it. My particular problem is when there are multiple record types in the same xml file, all of which need to be edited on a single page, with all changes submitted to the server as a single transaction. The example does not quite seem to address that issue.

Kind Regards,


4 Jan 2011, 5:13 PM
Hi Guys,

I am also trying to load xml file from some location. I am able to open that xml file from my browser, but when loading using js it is keep on loading. I believe my code is not correct. I also tried to save that file locally and load from js, it works.
my code is like:

var mystore = new Ext.data.Store({
model : 'mydata',
sorters : 'cityNameKey',
proxy : {
type : 'ajax',
url : 'TestData.xml',//when using local file and it works
// url: 'http://xxx.us/gkdata/TestData.xml',
reader : {
type : 'xml',
root : 'data',
record : 'dict'
autoLoad : true

any suggestions.

5 Jan 2011, 2:33 AM

Obviously I'm no expert, but to load xml data, I think you should use an xmlstore, as opposed to a regular store, no idea if that makes a difference, but my one works on an xml store.

Mine also seems to work well, regardless of whether retrieving files from local file system, or from a url. Note however, that because of firefox security issues, the xml file must be served from the same server that you served your original page issue. If you ask google about "Firefox cross domain ajax" it will tell you more. ExtJS does support this I believe through a "ScriptTagProxy", but you need someone who knows more than me to explain that further.

So rather than entering your url as http...., simply enter it as /gkdata/testdata.xml and it should work, presuming the file is served from that location. If you have any problems, use firebug to watch the http requests that are being generated, to see exactly what is being requested.

Kind Regards,