I work for a project of mobile application and I have a problem to retrieve informations by using proxy in a store. It's an application to manage Train Stations, and for a Station, I call a WebService which retrieve the 10 next trains ( in json ).
I have 2 classes, TrainStation ( Gare in french ;) ) and Train
the method in Gare to retrieve the Trains:
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);
}
the class Train ( which extend Model to using the method ):
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);
},
});
When I call my method with a valid train station, my console.log(trains); retrieve an empty object ...
my 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
}
]
What the problem?