bootstrap-table如何获得服务器返回的JSON数据中的二级数组?

发布于 2022-09-05 04:35:48 字数 3517 浏览 14 评论 0

有两个表是一对多关系的,服务器返回的数据里面包含了这两个表的数据,其中“多”的那个是以List/数组形式储存的。请问bootstrap-table的data-field要怎样才能获得这个List的数据呢(例如channelLogs里面的callerUuid)?还是说只能以父子表的做法分开两次取得?
以下是返回的JSON数据

{

"success": true,
"status": "200",
"msg": "",
"result": {
    "pageNumber": 1,
    "pageSize": 10,
    "count": 126,
    "list": [
        {
            "isNewRecord": true,
            "cid": 1,
            "vcid": "1",
            "callUuid": "ABC123",
            "callerExtNum": "1005",
            "callerUuid": "ABC1005",
            "callerTerminalType": 2,
            "calleeExtNum": "1018",
            "calleeUuid": "ABC1018",
            "calleeTerminalType": 1,
            "answerTime": 1499054430000,
            "callEndTime": 1499055690000,
            "hostName": "node1.test1.com",
            "status": 5,
            "channelLogs": [
                {
                    "isNewRecord": true,
                    "callerUuid": "ABC1005",
                    "callDirection": "inbound",
                    "callerExtNum": "1005",
                    "callerIp": "10.1.39.90",
                    "callerTerminalType": 1,
                    "calleeExtNum": "1004",
                    "calleeIp": "10.1.40.42",
                    "channelStartTime": 1499428457000,
                    "channelDestroyTime": 1499428467000
                },
                {
                    "isNewRecord": true,
                    "callerUuid": "ABC1018",
                    "callDirection": "outbound",
                    "callerExtNum": "1005",
                    "callerIp": "10.1.39.90",
                    "callerTerminalType": 1,
                    "calleeExtNum": "1006",
                    "calleeIp": "10.1.39.90",
                    "channelStartTime": 1499584654000,
                    "channelDestroyTime": 1499584660000
                }
            ]
        },
        {
            "isNewRecord": true,
            "cid": 2,
            "vcid": "2",
            "callUuid": "ABC124",
            "callerExtNum": "1008",
            "callerUuid": "ABC1241008",
            "callerTerminalType": 2,
            "calleeExtNum": "1018",
            "calleeUuid": "ABC1241018",
            "calleeTerminalType": 1,
            "answerTime": 1499055934000,
            "callEndTime": -28800000,
            "hostName": "node1.test1.com",
            "status": 2
        },
        {
            "isNewRecord": true,
            "cid": 10,
            "callerExtNum": "1005",
            "callerUuid": "654392a0-6305-11e7-8044-ab4417eaf6a1",
            "callerTerminalType": 1,
            "calleeExtNum": "1004",
            "calleeTerminalType": 2,
            "answerTime": -28800000,
            "callEndTime": -28800000,
            "hostName": "10.1.40.42",
            "status": 1,
            "channelLogs": [
                {
                    "isNewRecord": true,
                    "callerUuid": "654392a0-6305-11e7-8044-ab4417eaf6a1",
                    "callDirection": "inbound",
                    "callerExtNum": "1005",
                    "callerIp": "10.1.39.90",
                    "callerTerminalType": 1,
                    "calleeExtNum": "1004",
                    "calleeIp": "10.1.40.42",
                    "channelStartTime": 1499426048000,
                    "channelDestroyTime": 1499426108000
                }
            ]
        }
                ],
    "sort": "",
    "order": "",
    "firstResult": 0,
    "maxResults": 10
}

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

触ぅ动初心 2022-09-12 04:35:48

表格配置选项里添加:

responseHandler: function(res) {

      return res.list[0].channelLogs;

},

满身野味 2022-09-12 04:35:48

你好,这个问题解决了吗?我也遇到了

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文