后台返回的数据格式和bootstrap-table默认的格式不同怎么改?
bootstrap-table的数据格式为
[
{
"id": 0,
"name": "测试11111",
"price": "¥0",
"column1": "c10",
"column2": "c20",
"column3": "c30",
"column4": "c40"
},
{
"id": 1,
"name": "测试1",
"price": "¥1",
"column1": "c10",
"column2": "c20",
"column3": "c30",
"column4": "c40"
},
{
"id": 2,
"name": "测试2",
"price": "¥2",
"column1": "c10",
"column2": "c20",
"column3": "c30",
"column4": "c40"
},
{
"id": 3,
"name": "测试3",
"price": "¥3",
"column1": "c10",
"column2": "c20",
"column3": "c30",
"column4": "c40"
},
{
"id": 4,
"name": "测试4",
"price": "¥4",
"column1": "c10",
"column2": "c20",
"column3": "c30",
"column4": "c40"
}
]
后台返回我的格式为
{
"msg":"查询成功",
"errcode":0,
"data":{
"rows":[
{
"id":"17",
"pharmacy_id":"4",
"drug_id":"6",
"price":"6.00",
"update_time":"2017-02-15 10:22:21",
"create_time":"2017-02-15 10:22:21",
"status":"1",
"drug_name":"苦参",
"p_price":"20.00",
"unit_text":"支"
},
{
"id":"16",
"pharmacy_id":"4",
"drug_id":"5",
"price":"5.00",
"update_time":"2017-02-15 10:22:20",
"create_time":"2017-02-15 10:22:20",
"status":"1",
"drug_name":"甘草",
"p_price":"5.00",
"unit_text":"袋"
},
{
"id":"15",
"pharmacy_id":"4",
"drug_id":"4",
"price":"4.00",
"update_time":"2017-02-15 10:22:16",
"create_time":"2017-02-15 10:22:16",
"status":"1",
"drug_name":"干姜",
"p_price":"10.00",
"unit_text":"克"
}
],
"total":"6"
}
}
格式不一样 表格获取不到数据怎么改?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
已解决,加上这个就好了
为什么我照你的这样写的还是不行呢 急急急 求楼主回答 除咯这里这样写 columns里面有什么特殊的写法吗
你个坑货。。。我解决咯。。。你这样根本不行。。。。。
根据server或client作分页时,table的data传参方式不一样