【发布时间】:2015-12-30 11:25:29
【问题描述】:
我有数据结果:
{
"statusCode": "T",
"statusMessage": "Success",
"resultFeasibility": {
"resultStatus": 7005,
"resultInfo": "Fiber
access is available"
},
"devices": {
"deviceID": "2573631",
"hostName": "ODP-SKB-FCP\/003 FCP\/D01\/003.01",
"networkLocation": "ODP-SKB-FCP\/003",
"technology": "GPON",
"stoCode": "SKB",
"maxSpeed": null,
"double": 0,
"icon": "resources\/images\/icon-gphone-blue.png",
"address": {
"latitude": "-6.915",
"longitude": "106.9185",
"zipCode": null,
"district": null,
"city": null,
"streetName": null,
"lineOne": null
},
"markerId": "7-2573631",
"type": "ALPRO"
}
}
我想显示出现了多少“deviceID”,这是我的代码: 代码:
if (result.statusCode == 'T') {
this.odp = result.devices;
console.log(this.odp);
if (this.odp.length > 0) {
var alproType = this.odp.technology;
if (alproType == 'DSLAM')
this.feasibilityResult.push('feasibility DSLAM: ' + this.odp.length + ' DSLA');
else if (alproType == 'MSAN')
this.feasibilityResult.push('feasibility MSAN: ' + this.odp.length + ' MSAN');
else
this.feasibilityResult.push('feasibility ODP: ' + this.odp.length + ' ODP');
}
但输出为空。有人可以帮助我吗?谢谢
【问题讨论】:
-
看起来
this.odp.length > 0是false。 -
你能更新多台设备的 JSON
-
究竟哪个值为空?您的第一个 console.log 日志记录是否为空?或者是可行性结果数组?
-
@Glubus 'this.odp.length' isundefined...
标签: javascript arrays extjs string-length