zoukankan      html  css  js  c++  java
  • 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"
    }
  • 相关阅读:
    web socket RFC6455 frame 打包、解包
    Cacti 加入多台主机带宽汇聚
    C-链表实现,保存文件,评估-单项选择题系统课程设计---ShinePans
    ios7.1安装提示"无法安装应用程序 由于证书无效"的解决方式二(dropbox被封项目转移到Appharbor上)
    【模板】第二类斯特林数·列
    2018-8-10-win10-uwp-slider-隐藏显示数值
    2018-8-10-win10-uwp-slider-隐藏显示数值
    2019-1-27-WPF-使用-ItemsPanel-修改方向
    2019-1-27-WPF-使用-ItemsPanel-修改方向
    2018-8-10-win10-uwp-x_Bind-无法获得资源
  • 原文地址:https://www.cnblogs.com/lichihua/p/10459321.html
Copyright © 2011-2022 走看看