2014-05-01 1 views
0

나머지를 사용하여 서버에서 데이터를 가져 오는 프록시에서로드 된 목록을 가져 오려고합니다. 내가 뭘 잘못하고 있는지 알 수는 없지만 Chrome의 네트워크 통화 기록에/레스토랑에 대한 GET 요청이 표시되지 않습니다. 원래 나는 컨트롤러가 포함되지 않았을 것이라고 생각했지만, 모든 것이 거기에 있으며, 스토어에 데이터를 추가 할 때 채워집니다. 이 모든 오류를 던지고 있지 않습니다, 그래서 그것을 디버깅 할 수 없습니다. 가능한 모든 튜토리얼과 문서를 찾을 수있었습니다. 어떤 도움이나 통찰력이라도 대단히 감사하겠습니다.Sencha Touch 2 프록시가 요청을 실행하지 않음

컨트롤러 :

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

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

모델 :

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

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

가기 :

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' 
    } 
} 
}); 

보기 :

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

컨트롤러에 'stores'를 지정하지 않았습니다. –

+0

app.js에 상점을 포함 시켰습니다. 컨트롤러에 추가하려고 시도했지만 아무런 차이가 없었습니다. 상점에 데이터를 포함하면 레스토랑 목록에 예상대로 표시됩니다. 그러나 대리인은 발사하기를 원하지 않는 것 같습니다. 나는 모델에서도 성공하지 못했습니다. –

답변

2

잘못된 위치에 autoLoad가있는 것으로 나타났습니다. 프록시 설정 내에 있으면 안됩니다. 대신 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' 
} 
});