w906708477
2016-08-03 06:28
采纳率: 50%
浏览 1.5k
已采纳

使用EasyUI datagrid读取json数据出不来

以下是一条json数据:

{"aerocraft":{"aveVelocity":10,"batteryCapacity":"1520","id":"e5cbd935-8924-4b60-a443-d3783397cde6","maxAngle":12,"maxDistance":10,"maxHeight":10,"maxRange":10,"name":"宇辰盛景三号","powerConsumption":11},"endLonlat":"104.08150655657,35.090507220583","id":"5de13084-3dc5-402c-972e-66e1f9edf3c1","name":"任务一航迹三","routeGisinfo":"103.67240593097,35.188121042777 103.8413107469,35.318638400541 104.0025380712,35.38773582524 104.11441009214,35.313154477946 104.13086185992,35.182637120181 104.08150655657,35.090507220583","routeLength":0.76,"startLonlat":"103.67240593097,35.188121042777","task":{"id":"d1db79a5-3b28-4503-bc76-f742070ff42a","name":"宇辰盛景任务一","startTime":"2016-07-20 14:20:55"},"timeLength":0.08}

以下是js代码

{field: 'name',title: '航迹名称', width: 100},
{field: 'routeLength', title: '路径总长', width: 100,hidden: false },
{field: 'aerocraft.name',title: '飞行器',width: 100,hidden: false }

粗体字的地方为什么获取不到?

怎么样才能获取到aerocraft的name属性

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • 已采纳

    easyui不支持这样配置字段,配置为aerocraft,然后添加formatter返回这个这字段值的name属性

     {field: 'aerocraft',title: '飞行器',width: 100,hidden: false,formatter:function(v){return v.name} }
    
    已采纳该答案
    打赏 评论

相关推荐 更多相似问题