Brandon Kindred
Brandon Kindred

Reputation: 1488

Sencha Touch 2 proxy not firing any requests

I'm trying to just get a list loaded from a proxy that uses rest to get data from the server. I can't figure out what I'm doing wrong, but I don't see any GET requests to /restaurants in Chrome's network call log. Originally I thought maybe the controller wasn't being included, but it's all there and when I add data in the store it populates. This isn't throwing any errors, so I can't debug it. I've gone through every possible tutorial I could find as well as the documentation. Any help or insight is greatly appreciated.

Controller:

Ext.define('Appetize.controller.Restaurants', {
  extend: 'Ext.app.Controller',

  config: {
    models: ['Restaurant'],
    views:  [
      'RestaurantList',
    ],
    refs: {
    },
    control: { }
 }
}

Model:

Ext.define('Appetize.model.Restaurant', {
  extend: 'Ext.data.Model',

  config: {
    fields: [
      {name: 'id'},
      {name: 'name'},
      {name: 'delivers'},
      {name: 'active'}
    ]
  }
});

store:

Ext.define('Appetize.store.Restaurants', {
  extend: 'Ext.data.Store',
  requires: ['Appetize.model.Restaurant'],
  config: {
    model: 'Appetize.model.Restaurant',
    proxy: {
        type: 'rest',
        url: '/restaurants',
        autoLoad: 'true'
    } 
 }
});

View:

Ext.define('Appetize.view.RestaurantList', {
  extend: 'Ext.List',
  xtype: 'restaurantListCard', 
  config: {
    iconCls:          'home',
    title:            'Restaurants',
    id:               'restaurantList',
    store:            'Restaurants',
    onItemDisclosure: true,
    itemTpl:          '{name}'
  }
});

Upvotes: 0

Views: 117

Answers (1)

Brandon Kindred
Brandon Kindred

Reputation: 1488

It turns out I had autoLoad in the wrong place. It shouldn't be within the proxy settings. Instead it should be outside the proxy as part of config.

Ext.define('Appetize.store.Restaurants', {
  extend: 'Ext.data.Store',
  requires: ['Appetize.model.Restaurant'],
  config: {
    model: 'Appetize.model.Restaurant',
    proxy: {
        type: 'rest',
        url: '/restaurants',
    },
    autoLoad: 'true' 
 }
});

Upvotes: 2

Related Questions