mardi 30 septembre 2014

Accessing multipul dimensions of an ajax request

Greetings all! I've got api that generates JSON for me to consume in extjs. I've got a model set up for the fields

Code:



fields: [
{
name: 'UNID'
},
{
name: 'MIN_IN_STAT'
},
{
name: 'UNIT_STATUS'
},
{
name: 'NUM_1'
},
{
name: 'CDTS'
}
]

but I'd like to access data being passed at a higher level of the response than that. My new response is structured like so:


Code:



{"totalCount":"9","totalServiceClosed":"3","totalTroubleClosed":"0","Events":[{"UNID":"79607","MIN_IN_STAT":0.0,"UNIT_STATUS":"ER","NUM_1":"005195652","CDTS":"20140930160716CD"},{"UNID":"79607","MIN_IN_STAT":1.0,"UNIT_STATUS":"AR","NUM_1":"005195652","CDTS":"20140930160720CD"},{"UNID":"79607","MIN_IN_STAT":1.0,"UNIT_STATUS":"AM","NUM_1":"005195652","CDTS":"20140930160830CD"},{"UNID":"79607","MIN_IN_STAT":1.0,"UNIT_STATUS":"ER","NUM_1":"005195660","CDTS":"20140930160902CD"},{"UNID":"79607","MIN_IN_STAT":5.0,"UNIT_STATUS":"AR","NUM_1":"005195660","CDTS":"20140930161015CD"},{"UNID":"79607","MIN_IN_STAT":1.0,"UNIT_STATUS":"AM","NUM_1":"005195660","CDTS":"20140930161542CD"},{"UNID":"79607","MIN_IN_STAT":3.0,"UNIT_STATUS":"ER","NUM_1":"005201747","CDTS":"20140930161625CD"},{"UNID":"79607","MIN_IN_STAT":3.0,"UNIT_STATUS":"AR","NUM_1":"005201747","CDTS":"20140930161923CD"},{"UNID":"79607","MIN_IN_STAT":0.0,"UNIT_STATUS":"AM","NUM_1":"005201747","CDTS":"20140930162208CD"}]}

I'd like to take the totalServiceClosed and totalTroubleClosed and just throw them into a variable once the ajax request is loaded, but I don't know where to look to access the info. I tried to add another reader, but Sencha Architect isn't letting me. Any help or direction is very much appreciated! Thanks!

EXTJS 4.2.3 w/Sencha Architect 3.0.4.1386




Accessing multipul dimensions of an ajax request

Aucun commentaire:

Enregistrer un commentaire