Results 1 to 5 of 5

Thread: Question Regarding DataStores

  1. #1

    Default Question Regarding DataStores

    The following code comes directly from one of the grid examples and it works fine:

    PHP Code:
        var store = new Ext.data.Store({

            
    // load using HTTP
            
    url'plants.xml',

            
    // the return will be XML, so lets set up a reader
            
    reader: new Ext.data.XmlReader({
                   
    // records will have a "plant" tag
                   
    record'plant'
               
    }, Plant),

            
    sortInfo:{field:'common'direction:'ASC'}
        }); 

    Instead of getting the data from an XML file I want to retrieve the data using a Servlet. I changed the URL option to point to a Servlet but now the store does not seems to be working correctly (see code below.) I verified the Servlet is sending the correct XML data to the output stream. In fact, if I take the Servlet output and past it in an XML file and then point the URL to that file everything works fine. Is there something else I need to do to retrieve the data from a Servlet rather than a file?
    Thanks,

    PHP Code:

        
    var store = new Ext.data.Store({

            
    // load using HTTP
              
    url:'http://199.131.146.205:8988/prototypes-EXT-context-root/loadViewColumns?viewName='+viewName,

            
    // the return will be XML, so lets set up a reader
            
    reader: new Ext.data.XmlReader({
                   
    // records will have a "plant" tag
                   
    record'plant'
               
    }, Plant),

            
    sortInfo:{field:'common'direction:'ASC'}
        }); 

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    1. The server needs to be in the same domain (199.131.146.205:8988).
    2. The response content type needs to be text/xml.
    3. Add a loadexception handler to the store to identify other errors.

  3. #3

    Default

    The server is in the same domain and I verified the content type is "text/xml".

    I added a loadexception handler and received the message:

    "XmlReader.read: XML Document not available"

    Any suggestions?

  4. #4
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    Please recheck the content type. Only 'text/xml' and 'application/xml' are allowed.

  5. #5

    Default

    I double checked and the content type was incorrect.
    Thanks for the help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •