Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hey guys,

I'm building an EXT JS project with a grid. Its store is defined with the following:

JavaScript
createStore     :  function() {
       var me = this;
       me.createDataModel();
       var store = Ext.create("Ext.data.Store", {
           model       :  "tescoModel",
           id          :  "tescoStore",
           autoLoad    :  true,
           remoteSort  :  true,
           pageSize    :  20,
           proxy       :  {
               type            : "ajax",
               url             : "http://www.techfortesco.com/groceryapi_b1/restservice.aspx",
               limitParam      : undefined,
               startParam      : undefined,
               simpleSortMode  : true,
               pageParam       : undefined,
               noCache         : false,
               actionMethods   : {
                   method  : "POST"
               },
               reader           : {
                   type            : "json",
                   root            : "Products",
                   totalProperty   : "TotalProductCount"
               }
          }
       });


This however is not returning anything at all, it won't even make a connection to http://www.techfortesco.com....
I believe that extjs only allows to make connections to internal links (e.g. /techfortesco).

Is it possible for extjs to create a store from an external link? Am I doing something wrong?

Thanks
Posted
Updated 7-Jan-13 6:06am
v4
Comments
Richard C Bishop 7-Jan-13 12:00pm    
This is not a question. Please provide more detail on what you are trying to accomplish and specify what your problem is.
Member 9736263 7-Jan-13 12:06pm    
Sorry about that, I've updated my question, hopefully it is more clear.

You need to use Proxy Type as 'jsonp'
JavaScript
createStore     :  function() {
       var me = this;
       me.createDataModel();
       var store = Ext.create("Ext.data.Store", {
           model       :  "tescoModel",
           id          :  "tescoStore",
           autoLoad    :  true,
           remoteSort  :  true,
           pageSize    :  20,
           proxy       :  {
               type            : "jsonp",
               url             : "http://www.techfortesco.com/groceryapi_b1/restservice.aspx",
               limitParam      : undefined,
               startParam      : undefined,
               simpleSortMode  : true,
               pageParam       : undefined,
               noCache         : false,
               actionMethods   : {
                   method  : "POST"
               },
               reader           : {
                   type            : "json",
                   root            : "Products",
                   totalProperty   : "TotalProductCount"
               }
          }
       });
 
Share this answer
 
Try Loader feature of EXTJS -

loader: {
	    url: 'YourSourceUrl',
            renderer: 'component',
            autoLoad: true
	}



autoload: true, will load data automatically on initial loading.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900