responseHandler

resonsehandler 接受服务端传过来的数据,然后在这个函数里处理好要显示的数据在return个table显示

<!DOCTYPE html>
<html lang="zh-cn">
<head>
<title>bootstrapTable</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>



<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.js"></script>

<link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> 

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.13.5/dist/bootstrap-table.min.css">

<!-- Latest compiled and minified JavaScript -->
<script src="https://unpkg.com/bootstrap-table@1.13.5/dist/bootstrap-table.min.js"></script>
<!-- Latest compiled and minified Locales -->
<script src="https://unpkg.com/bootstrap-table@1.13.5/dist/locale/bootstrap-table-zh-CN.min.js"></script>

<link href="" rel="stylesheet">
<script src="" type="text/javascript"></script>    
<style>

</style>
</head>

<body>
<table id="table"></table>

<script>
  $(function() {
    $('#table').bootstrapTable({
      url: 'json/353.json',
      columns: [{
        field: 'date',
        title: 'Date Stamp',
        sortable: true
      }, {
        field: 'm_type',
        title: 'Type',
        sortable: true
      }, {
        field: 'msdn',
        title: 'MSDN',
        sortable: true
      }, {
        field: 'file_name',
        title: 'File Name',
        sortable: true
      }, {
        field: 'message',
        title: 'Message',
        sortable: true
      }],
      responseHandler: function (res) {

        console.log(res)
        return res.messages
      }
    })
  })
</script>

</body>
</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/lichihua/p/10459321.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值