1. #1
    Ext JS Premium Member
    Join Date
    Jul 2010
    Posts
    191
    Vote Rating
    0
    rebeccapeltz is on a distinguished road

      0  

    Default Using proxy store

    We're using file servers instead web servers. Can you tell me if it's possible to use the proxy store with file servers? I'm getting the access-control-origin error: XMLHttpRequest cannot load file:///O:/devel/v1.0/web/nonproduct...art=0&limit=25. Origin null is not allowed by Access-Control-Allow-Origin.

  2. #2
    Ext JS Premium Member
    Join Date
    Dec 2010
    Location
    Hamburg, Germany
    Posts
    196
    Vote Rating
    7
    winkelmann will become famous soon enough

      0  

    Default

    Direct file system access (which is what the file:/// protocol represents) gets blocked by your browser. If that was possible, any script on any website could simply read your local harddrive by loading file:///c:/myfile.txt. Thats not something you really want, is it? :-)

    What _could_ theoretically work is using JsonPProxy
    http://dev.sencha.com/deploy/ext-4.0...oxy.JsonP.html

    Haven't used that myself yet though, you might give it a try and let me know :-)

  3. #3
    Ext JS Premium Member
    Join Date
    Jul 2010
    Posts
    191
    Vote Rating
    0
    rebeccapeltz is on a distinguished road

      0  

    Default JsonP proxy returns data but..

    I'm testing out your AccountManager reference application. I build the MVC store as show below. My callBackPrefix of ABC is defined in a function ABC which does get called and the data parameter does contain data, but the store doesn't automatically load with the data. Is there a way to make this happen? Should I not be using this inside an MVC Store script? Should I be applying the data that is returned to the store somehow in the callback?

    Code:
     
    
    function ABC(data){ alert('hi'); } Ext.require('Ext.data.proxy.JsonP'); Ext.define('AM.store.UsersStore', { extend: 'Ext.data.Store', model: 'UserModel', autoLoad: true, proxy: { type: 'jsonp', url: 'data/users.json', callbackPrefix: 'ABC' }
    });

  4. #4
    Ext JS Premium Member
    Join Date
    Jul 2010
    Posts
    191
    Vote Rating
    0
    rebeccapeltz is on a distinguished road

      0  

    Default more on JSONP

    I also tried adding the reader but control passes to ABC and then I just get the alert. There is a loading image that continues to run as well.

    Code:
     
    function ABC(data){
    alert(data.users[0].email);
    }
    
    Ext.require('Ext.data.proxy.JsonP');
    Ext.define('AM.store.UsersStore', {
    extend: 'Ext.data.Store',
    model: 'UserModel',
    autoLoad: true,
    proxy: {
    type: 'jsonp',
    url: 'data/users.json',
    callbackPrefix: 'ABC',
    reader: {
    type: 'json',
    root: 'users',
    successProperty: 'success'
    }
    }
    
    });

Similar Threads

  1. Store with Ajax proxy
    By Wyx in forum Ext: Discussion
    Replies: 0
    Last Post: 29 Apr 2011, 6:57 AM
  2. Store vs Proxy
    By mikih in forum Sencha Touch 1.x: Discussion
    Replies: 2
    Last Post: 11 Jan 2011, 3:01 PM
  3. Use of Proxy with a Store for a List
    By Nemo76 in forum Sencha Touch 1.x: Discussion
    Replies: 1
    Last Post: 15 Dec 2010, 3:00 AM
  4. Proxy data store
    By dpicky in forum Sencha Touch 1.x: Discussion
    Replies: 1
    Last Post: 6 Oct 2010, 7:39 AM
  5. Change Store Proxy URL without Creating New Store
    By rkdeiss in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 13 Apr 2010, 11:16 AM

Thread Participants: 1