Click here to Skip to main content
12,454,477 members (56,773 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: ExtJS
Hey guys,

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

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 7-Jan-13 5:56am
Updated 7-Jan-13 6:06am
v4
Comments
richcb 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.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

You need to use Proxy Type as 'jsonp'
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"
               }
          }
       });
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Try Loader feature of EXTJS -

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


autoload: true, will load data automatically on initial loading.
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160826.1 | Last Updated 19 Feb 2014
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100