0
我爲移動應用程序的項目工作,並且在商店中使用代理檢索信息時遇到問題。 這是一個管理火車站的應用程序,對於一個車站,我調用一個WebService來檢索10個下一班列車(在json中)。Sencha touch 2:通過代理在商店中檢索信息
我有2類,TrainStation(火車站在法國))與列車
在火車站的方法來檢索火車:
getListTrains: function(TR3A) {
console.log('plop');
var trains = Ext.create('Ext.data.Store', {
model: 'Train',
proxy: {
type: 'ajax',
url: 'http://eclernet-mobile.dev.dsit-hp.sncf.fr/Trainservice.svc/GetListTrainsAtGare/'+TR3A,
method: 'POST',
headers: {
'Accept': 'application/json'
},
reader: {
type: 'json'
}
}
});
console.log(trains);
}
類列車(其延伸模型使用該方法):
Ext.define('Train', {
extend: 'Ext.data.Model',
config: {
codeMission: null,
numero: null,
sens: null,
dessertes: null,
voie: null,
heureProbable: null,
heureTheorique: null,
voiePrecedente: null,
quai: null,
retard: null
},
constructor: function(config) {
this.initConfig(config);
},
});
當我打電話給我的方法與有效的火車站,我的console.log(火車);檢索一個空對象...
我的JSON:
[
{
"codeMission": "AMIE",
"dessertes": [
{
"codeTR3A": "VPL",
"nom": "Villiers St Paul"
},
{
"codeTR3A": "RIA",
"nom": "Rieux Angicourt"
},
{
"codeTR3A": "PXE",
"nom": "Pont Ste Maxence"
},
{
"codeTR3A": "CVE",
"nom": "Chevrieres"
},
{
"codeTR3A": "LUE",
"nom": "Longueil Ste Marie"
},
{
"codeTR3A": "LXS",
"nom": "Le Meux La Croix"
},
{
"codeTR3A": "CPE",
"nom": "Compiegne"
}
],
"heureProbable": "02/08/2012 15:21",
"heureTheorique": "02/08/2012 15:21",
"numero": "847809",
"quai": null,
"retard": null,
"sens": "I",
"voie": "1",
"voiePrecedente": null
},
{
"codeMission": "PADI",
"dessertes": [
{
"codeTR3A": "CLY",
"nom": "Chantilly Gouvieux"
},
{
"codeTR3A": "ORY",
"nom": "Orry la Ville"
},
{
"codeTR3A": "PNO",
"nom": "Paris Nord GL"
}
],
"heureProbable": "02/08/2012 15:39",
"heureTheorique": "02/08/2012 15:39",
"numero": "847616",
"quai": null,
"retard": null,
"sens": "P",
"voie": "DE",
"voiePrecedente": null
},
{
"codeMission": "TOLI",
"dessertes": [
{
"codeTR3A": "SLT",
"nom": "St Leu d'Esserent"
},
{
"codeTR3A": "PYO",
"nom": "Précy sur Oise"
},
{
"codeTR3A": "BRN",
"nom": "Boran sur Oise"
},
{
"codeTR3A": "BRK",
"nom": "Bruyères sur Oise"
},
{
"codeTR3A": "PEB",
"nom": "Persan Beaumont"
},
{
"codeTR3A": "CPO",
"nom": "Champagne sur Oise"
},
{
"codeTR3A": "IAP",
"nom": "L'Isle Adam Parmain"
},
{
"codeTR3A": "VMD",
"nom": "Valmondois"
},
{
"codeTR3A": "AUW",
"nom": "Auvers sur Oise"
},
{
"codeTR3A": "CPW",
"nom": "Chaponval"
},
{
"codeTR3A": "PPT",
"nom": "Pont Petit"
},
{
"codeTR3A": "EPL",
"nom": "Epluches"
},
{
"codeTR3A": "SOA",
"nom": "St Ouen l'Aumone"
},
{
"codeTR3A": "PSE",
"nom": "Pontoise"
}
],
"heureProbable": "02/08/2012 15:54",
"heureTheorique": "02/08/2012 15:54",
"numero": "121038",
"quai": null,
"retard": null,
"sens": "P",
"voie": "DE",
"voiePrecedente": null
},
{
"codeMission": "ZUCO",
"dessertes": [
{
"codeTR3A": "CLY",
"nom": "Chantilly Gouvieux"
},
{
"codeTR3A": "ORY",
"nom": "Orry la Ville"
},
{
"codeTR3A": "BBN",
"nom": "La Borne Blanche"
},
{
"codeTR3A": "SUR",
"nom": "Survilliers Fosses"
},
{
"codeTR3A": "LOV",
"nom": "Louvres"
},
{
"codeTR3A": "LNX",
"nom": "Les Noues"
},
{
"codeTR3A": "GOU",
"nom": "Goussainville"
},
{
"codeTR3A": "VIB",
"nom": "Villiers le Bel"
},
{
"codeTR3A": "GAJ",
"nom": "Garges Sarcelles"
},
{
"codeTR3A": "PRF",
"nom": "Pierrefitte Stains"
},
{
"codeTR3A": "SDE",
"nom": "St Denis"
},
{
"codeTR3A": "SFD",
"nom": "Stade de France St D"
},
{
"codeTR3A": "GDS",
"nom": "Paris Nord RER"
},
{
"codeTR3A": "CLX",
"nom": "Châtelet les Halles"
},
{
"codeTR3A": "PAA",
"nom": "Paris Lyon Banlieue"
},
{
"codeTR3A": "MFA",
"nom": "Maisons Alfort"
},
{
"codeTR3A": "VSG",
"nom": "Villeneuve S Georges"
},
{
"codeTR3A": "KRW",
"nom": "Montgeron Crosne"
},
{
"codeTR3A": "YES",
"nom": "Yerres"
},
{
"codeTR3A": "BNY",
"nom": "Brunoy"
},
{
"codeTR3A": "BXI",
"nom": "Boussy St Antoine"
},
{
"codeTR3A": "CBV",
"nom": "Combs la Ville"
},
{
"codeTR3A": "LIU",
"nom": "Lieusaint Moissy"
},
{
"codeTR3A": "ZTN",
"nom": "Savigny le Temple"
},
{
"codeTR3A": "CES",
"nom": "Cesson"
},
{
"codeTR3A": "WEE",
"nom": "Le Mée"
},
{
"codeTR3A": "MEL",
"nom": "Melun"
}
],
"heureProbable": "02/08/2012 15:59",
"heureTheorique": "02/08/2012 15:59",
"numero": "153260",
"quai": null,
"retard": null,
"sens": "P",
"voie": "DE",
"voiePrecedente": null
},
{
"codeMission": "PADI",
"dessertes": [
{
"codeTR3A": "PNO",
"nom": "Paris Nord GL"
}
],
"heureProbable": "02/08/2012 16:07",
"heureTheorique": "02/08/2012 16:07",
"numero": "848522",
"quai": null,
"retard": null,
"sens": "P",
"voie": "2",
"voiePrecedente": null
},
{
"codeMission": "AMIE",
"dessertes": [
{
"codeTR3A": "PXE",
"nom": "Pont Ste Maxence"
},
{
"codeTR3A": "CPE",
"nom": "Compiegne"
},
{
"codeTR3A": "NOY",
"nom": "Noyon"
},
{
"codeTR3A": "CNY",
"nom": "Chauny"
},
{
"codeTR3A": "TGR",
"nom": "Tergnier"
},
{
"codeTR3A": "SQ",
"nom": "St Quentin"
}
],
"heureProbable": "02/08/2012 16:35",
"heureTheorique": "02/08/2012 16:35",
"numero": "847907",
"quai": null,
"retard": null,
"sens": "I",
"voie": "1",
"voiePrecedente": null
},
{
"codeMission": "PADI",
"dessertes": [
{
"codeTR3A": "CLY",
"nom": "Chantilly Gouvieux"
},
{
"codeTR3A": "ORY",
"nom": "Orry la Ville"
},
{
"codeTR3A": "PNO",
"nom": "Paris Nord GL"
}
],
"heureProbable": "02/08/2012 16:40",
"heureTheorique": "02/08/2012 16:40",
"numero": "847822",
"quai": null,
"retard": null,
"sens": "P",
"voie": "2",
"voiePrecedente": null
},
{
"codeMission": "AMIE",
"dessertes": [
{
"codeTR3A": "LAI",
"nom": "Laigneville"
},
{
"codeTR3A": "LIA",
"nom": "Liancourt Rantigny"
},
{
"codeTR3A": "CDO",
"nom": "Clermont de l'Oise"
},
{
"codeTR3A": "AVY",
"nom": "Avréchy"
},
{
"codeTR3A": "SJS",
"nom": "St Just en Chaussée"
}
],
"heureProbable": "02/08/2012 16:43",
"heureTheorique": "02/08/2012 16:43",
"numero": "848517",
"quai": null,
"retard": null,
"sens": "I",
"voie": "1",
"voiePrecedente": null
},
{
"codeMission": "TOLI",
"dessertes": [
{
"codeTR3A": "SLT",
"nom": "St Leu d'Esserent"
},
{
"codeTR3A": "PYO",
"nom": "Précy sur Oise"
},
{
"codeTR3A": "BRN",
"nom": "Boran sur Oise"
},
{
"codeTR3A": "BRK",
"nom": "Bruyères sur Oise"
},
{
"codeTR3A": "PEB",
"nom": "Persan Beaumont"
},
{
"codeTR3A": "CPO",
"nom": "Champagne sur Oise"
},
{
"codeTR3A": "IAP",
"nom": "L'Isle Adam Parmain"
},
{
"codeTR3A": "VMD",
"nom": "Valmondois"
},
{
"codeTR3A": "AUW",
"nom": "Auvers sur Oise"
},
{
"codeTR3A": "CPW",
"nom": "Chaponval"
},
{
"codeTR3A": "PPT",
"nom": "Pont Petit"
},
{
"codeTR3A": "EPL",
"nom": "Epluches"
},
{
"codeTR3A": "SOA",
"nom": "St Ouen l'Aumone"
},
{
"codeTR3A": "PSE",
"nom": "Pontoise"
}
],
"heureProbable": "02/08/2012 16:54",
"heureTheorique": "02/08/2012 16:54",
"numero": "121042",
"quai": null,
"retard": null,
"sens": "P",
"voie": "DE",
"voiePrecedente": null
},
{
"codeMission": "TSOL",
"dessertes": [],
"heureProbable": "02/08/2012 17:07",
"heureTheorique": "02/08/2012 17:07",
"numero": "121031",
"quai": null,
"retard": null,
"sens": "I",
"voie": "AE",
"voiePrecedente": null
}
]
什麼問題?
我已經說明了這一點,這是行得通的! autoLoad:真的,非常感謝您的回覆! – Craysis 2012-08-03 08:59:12
歡迎...不要忘記標記帖子爲答案, – olegtaranenko 2012-08-03 09:16:45