responseHandler

 1 <!DOCTYPE html>
 2 <html lang="zh-cn">
 3 <head>
 4 <title>bootstrapTable</title>
 5 <meta charset="utf-8">
 6 <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
 7 
 8 
 9 
10 <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>
11 
12 <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> 
13 
14 <!-- Latest compiled and minified CSS -->
15 <link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.13.5/dist/bootstrap-table.min.css">
16 
17 <!-- Latest compiled and minified JavaScript -->
18 <script src="https://unpkg.com/bootstrap-table@1.13.5/dist/bootstrap-table.min.js"></script>
19 <!-- Latest compiled and minified Locales -->
20 <script src="https://unpkg.com/bootstrap-table@1.13.5/dist/locale/bootstrap-table-zh-CN.min.js"></script>
21 
22 <link href="" rel="stylesheet">
23 <script src="" type="text/javascript"></script>    
24 <style>
25 
26 </style>
27 </head>
28 
29 <body>
30 <table id="table"></table>
31 
32 <script>
33   $(function() {
34     $('#table').bootstrapTable({
35       url: 'json/353.json',
36       columns: [{
37         field: 'date',
38         title: 'Date Stamp',
39         sortable: true
40       }, {
41         field: 'm_type',
42         title: 'Type',
43         sortable: true
44       }, {
45         field: 'msdn',
46         title: 'MSDN',
47         sortable: true
48       }, {
49         field: 'file_name',
50         title: 'File Name',
51         sortable: true
52       }, {
53         field: 'message',
54         title: 'Message',
55         sortable: true
56       }],
57       responseHandler: function (res) {
58 
59         console.log(res)
60         return res.messages
61       }
62     })
63   })
64 </script>
65 
66 </body>
67 </html>

JSON

{
    "messages": [
        {
            "id": 652,
            "session_id": 8965861649940144331,
            "date": "2014-12-17T01:01:09Z",
            "m_type": "Error",
            "message": "could not find a matching MDF file for legacy SQL selection $SQL:\(local)\Adams",
            "file_name": "$SQL:\(local)\Adams",
            "msdn": 33
        },
        {
            "id": 653,
            "session_id": 8965861649940144331,
            "date": "2014-12-17T01:01:10Z",
            "m_type": "Error",
            "message": "could not find a matching MDF file for legacy SQL selection $SQL:\(local)\TRAINING",
            "file_name": "$SQL:\(local)\TRAINING",
            "msdn": 33
        }
    ],
    "session_id": 8965861649940144331,
    "date": "2014-12-17T01:55:14Z",
    "client_date": "2014-12-16T19:55:14Z",
    "actual_cpu": "",
    "licensed_cpu": "",
    "license": 1,
    "brand": 2,
    "account": 215,
    "computer": 289,
    "regcode": "1:2:215:289"
}
莫听穿林打叶声,何妨吟啸且徐行,竹杖芒鞋轻胜马,谁怕?一蓑烟雨任平生。
原文地址:https://www.cnblogs.com/WX1211/p/12034246.html