1. #1
    Ext User merry andrew's Avatar
    Join Date
    Jul 2010
    Location
    Ellensburg
    Posts
    25
    Vote Rating
    0
    merry andrew is on a distinguished road

      0  

    Default Ajax.request VS Store proxy

    Ajax.request VS Store proxy


    I'm trying to understand how the Ajax.request is represented in a Store's proxy configuration because I'd like to use a Store to handle the data retrieval. Here is the Ext.Ajax.request pulling successfully pulling data from a server:

    Code:
    var makeAjaxRequest = function() {
                Ext.Ajax.request({
                    url: 'http://myurl/Data.svc',
    				method: 'GET',
    				headers: {
    					'Accept': 'application/json'
    					//'Content-Type': '*/*', <-- toggle if errors appear
    				},
                    success: function(response, opts) {
    					var data = Ext.decode(response.responseText);
                        template.overwrite(panel.body, data.d);
    					Ext.getCmp('status').setTitle('json response loaded!');
                    }
                })
            };
    Here is how I'm trying to work with just a Store:

    Code:
    var personStore = new Ext.data.JsonStore({ // store to autoload Persons data... for list gen testing
    			model: 'Person',
    				
    			proxy: {
    				type: 'ajax',
    				url: 'http://myurl/Data.svc',
    				method: 'GET',
    					headers: {
    						'Accept': 'application/json'
    					}
    				reader: {
    					type: 'json',
    					root: 'results',
    					idProperty: 'juvis',							
    				}
    			},
    			
    			autoLoad: true,
    			
    			fields: [		
    				{name: 'firstName', mapping: 'FirstName'},
    				... etc
                            ]
    		});
    Where am I going wrong? Any advice would be greatly appreciated.

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,997
    Vote Rating
    649
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Currently there's nothing built in to let you customize the headers like that, we'll look into adding it in future.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

Similar Threads

  1. Ajax Proxy/Json Store
    By eldiego34 in forum Sencha Touch 1.x: Discussion
    Replies: 2
    Last Post: 19 Aug 2010, 4:59 AM
  2. add a param to all Ext.Ajax.request (tree, store, normal Ajax.request)
    By aj3423 in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 26 Jan 2010, 9:18 AM
  3. autoLoad vs Ext.Ajax.request... loadScripts not working w/Ajax.request
    By zhegwood in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 6 Aug 2009, 3:28 PM

Thread Participants: 1