jahertor / gwt-ext

Automatically exported from code.google.com/p/gwt-ext
0 stars 1 forks source link

Load data from XML #199

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

I am a newbie with GWT and GET-EXT. I am trying to load some data from an 
XML on the same domain as my application. I have tried HttpProxy + 
XmlReader. Also after looking at the FeedViewer example, tries with AJAX, 
but without any success. Here is my directory structure:

/data/appointments.xml
<?xml version="1.0" encoding="UTF-8"?>
<dataset>
  <appointments>
    <appointment>
        <id>1</id>
        <detail>Annual Physical Exam</detail>
        <doctor>Christopher Pead, MD</doctor>
        <date>03/10/2008 10:30 AM</date>
        <status>1</status>
    </appointment>
    <appointment>
        <id>2</id>
        <detail>Consultation (X-Ray)</detail>
        <doctor>Christopher Pead, MD</doctor>
        <date>01/20/2008 2:30 PM</date>
        <status>1</status>
    </appointment>
    <appointment>
        <id>3</id>
        <detail>Annual Physical Exam</detail>
        <doctor>Christopher Pead, MD</doctor>
        <date>12/18/2007 9:00 AM</date>
        <status>1</status>
    </appointment>
    <appointment>
        <id>4</id>
        <detail>Annual Physical Exam</detail>
        <doctor>Christopher Pead, MD</doctor>
        <date>11/11/2007 2:30 PM</date>
        <status>1</status>
    </appointment>
    <appointment>
        <id>5</id>
        <detail>Fever, Vomitting, Diahrea</detail>
        <doctor>Christopher Pead, MD</doctor>
        <date>10/24/2007 9:00 AM</date>
        <status>1</status>
    </appointment>
  </appointments>
</dataset>

/MyApplication.html

One of the code snippet I have tried:

        RecordDef recordDef =
            new RecordDef(new FieldDef[]{new StringFieldDef("id"),   
                                         new StringFieldDef("detail"),   
                                         new StringFieldDef("doctor"),
                                         new StringFieldDef("date"),
                                         new IntegerFieldDef("status")
                          }
        );

        XmlReaderConfig xmlReaderConfig = new XmlReaderConfig() {
            {
                setRecord("appointment"); 
                setId("id");
            }
        };
        XmlReader reader = new XmlReader(xmlReaderConfig, recordDef);

        Store store = new Store(reader);

        requestComplete(store.getJsObj
(), "http://localhost:8080/myapp/data/appointments.xml" );

        store.load();           

    public static native void requestComplete(JavaScriptObject store, 
String url) /*-{
        $wnd.Ext.Ajax.request( {method:"GET", url: url, callback: function
(connection, options, response) {            
                                store.loadData(response.responseXML);
        } } );
    }-*/;

Can someone provide me some code examples on how I can load the XML so 
that I can use it to populate a grid.

Regards,
-saurav

Original issue reported on code.google.com by sei.a...@gmail.com on 20 Jan 2008 at 1:29

GoogleCodeExporter commented 8 years ago
This is not an issue with GWT-Ext. 

You should be using HttpProxy to load this data. See the relevant code for 
GWT-Ext
2.0 here http://www.gwt-ext.com/dev/#editableGrid

If you have any further questions, please post on the GWT-Ext forum : 
gwt-ext.com/forum

Original comment by sanjiv.j...@gmail.com on 6 Feb 2008 at 10:06