Threaded View

  1. #1
    Sencha User CSchmitz81's Avatar
    Join Date
    Nov 2012
    Location
    Saint Louis
    Posts
    33
    Answers
    3
    Vote Rating
    0
    CSchmitz81 is on a distinguished road

      0  

    Default Answered: Problems getting my store's proxy config to work

    Answered: Problems getting my store's proxy config to work


    I'm trying to build a simple rss reader to get a handle on how stores work. I created the shell of the application and set up a list view with an item template, the correct model, and then created a store with inline data to verify it worked (which it did).

    I then tried commenting out my inline data in the store and replaced it with a proxy configuration to try to read directly from the rss feed's xml file and I can't get it to work. I'm not sure what I'm missing and really I'm not sure where to check in my browser's dev tools to troubleshoot.

    I also tried saving the xml to a file I stored within my project and changed my proxy config to use ajax and pointed it to the local file (you can see those config lines commented out) just to see if there was an error with getting it from the external domain and it still did not work.

    Could anyone help point me in the right direction?

    Here's my store's code:

    Code:
    Ext.define('DorklyReader.store.Feed',{
        extend: 'Ext.data.Store',
        requires: ['Ext.data.proxy.JsonP', 'Ext.data.reader.Xml'],
    
    
        config:{
            model: 'DorklyReader.model.Feed',
    
    
            proxy: {
                type: 'jsonp',
                url: 'http://www.dorkly.com/rss',
                // type: 'ajax',
                // url: 'store/exampleFeed.xml',
                reader: {
                    type: 'xml',
                    record: 'items',
                    rootProperty: 'items'
                },
                autoload: true
            }
    
    
    //The app works when reading from this inline data:
        //     data: [
        // // Build with sample data first before building the proxy section. 
        //     {guid: '1234', link: 'http://www.google.com', title: 'dog jumps over log', description: 'wow what a dog!'},
        //     {guid: '5678', link: 'http://www.google.com', title: 'cat sits on hat', description: 'typical cat!!'},
        //     {guid: '9098', link: 'http://www.google.com', title: 'fish swims!', description: 'who could have seen that coming?!!'},
        //     ]
        }
    });

  2. There is no xml proxy, you need to use ajax proxy. If you are wanting to do cross origin requests then the server will need to support CORS which is just a couple headers returned by the server and it will just work. http://enable-cors.org/

Thread Participants: 1

Tags for this Thread