Table的两种处理方法记录
简单记录一下,方便以后参考:基于JQuery实现
一种是滚轮,一种是翻页
滚轮的代码实现:
<div class="col-md-12" style="width:1250px;margin-left: 50px;margin-bottom: 100px ;overflow: scroll; overflow-x: hidden; height: 310px;">
<table id="tcp-conn-table" class="table table-bordered">
<colgroup>
<col width="20%"/>
<col width="18%"/>
<col width="20%"/>
<col width="20%"/>
<col width="10%"/>
<col width="12%"/>
</colgroup>
<thead class="alert-info">
<tr>
<th>IP地址</th>
<th>端口</th>
<th>实例类型</th>
<th>慢操作总数</th>
<th>slowline(ms)</th>
<th>连接详情</th>
</tr>
</thead>
<tbody id="add-server-row"></tbody>
</table>
</div> let rowStr = `<tr>
<td class="instance-name">${instanceGroup[i].name}</td>
<td class="instance-port">${instanceGroup[i].port}</td>
<td>${instanceGroup[i].role.replace(":", "")}</td>
<td>${countAll}</td>
<td>${slowLine}</td>
<td class="show-clientIP-conn"><button class="btn-sm btn-info">查看</button></td>
</tr>`;
dom.append(rowStr);
翻页的代码实现:
<div class="col-md-12" style="margin-bottom: 100px;">
<table id="operation-type-slowlog" class="table dataTable table-stat-viewer">
<thead>
<tr>
<th width="15%">慢操作发生时刻</th>
<th width="62%">慢操作指令</th>
<th width="10%">慢操作次数</th>
<th width="13%">慢操作平均耗时(ms)</th>
</tr>
</thead>
</table>
</div> // 初始化实例表格,以免出现宽度的问题
function initilizeTable(){
if(!operationTypeTable){
operationTypeTable = $("#operation-type-slowlog").DataTable({
dataTable: true,
sort: true,
filter: false,
paging: true,
pageLength: 10,
lengthChange: false,
dom: "<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
language: {
"infoEmpty": "没有符合条件的记录",
"zeroRecords": "没有找到任何记录",
"info": "共_TOTAL_种慢查询SQL",
"infoFiltered": "",
"paginate": {
"next": "下一页",
"previous": "上一页"
}
},
columnDefs: [{
"targets": [0],
"orderable": false
}],
order: [[3, "asc"]]
});
}
} operationTypeTable.clear();
statsData.map(stats =>{
if(operationType === stats.event.rap_dim_op_type){
let time = stats.timestamp.replace(".000+08:00", "").replace("T"," ");
let cmd = stats.event.rap_dim_cmd;
let count = stats.event.sum__count;
let avg_duration = parseInt(stats.event.sum_duration / (stats.event.sum__count * 1000));
operationTypeTable.row.add([time, cmd, count, avg_duration]);
}
});
operationTypeTable.draw();
Table的两种处理方法记录的更多相关文章
- map集合修改其中元素 去除Map集合中所有具有相同值的元素 Properties长久保存的流操作 两种用map记录单词或字母个数的方法
package com.swift.lianxi; import java.util.HashMap; import java.util.Iterator; import java.util.Map; ...
- git两种合并方法 比较merge和rebase
18:01 2015/11/18git两种合并方法 比较merge和rebase其实很简单,就是合并后每个commit提交的id记录的顺序而已注意:重要的是如果公司用了grrit,grrit不允许用m ...
- mysql in 的两种使用方法
简述MySQL 的in 的两种使用方法: 他们各自是在 in keyword后跟一张表(记录集).以及在in后面加上字符串集. 先讲后面跟着一张表的. 首先阐述三张表的结构: s(sno,sname. ...
- Linux系统中存储设备的两种表示方法
转:https://blog.csdn.net/holybin/article/details/38637381 一.对于IDE接口的硬盘的两种表示方法: 1.IDE接口硬盘,对于整块硬盘的两种表示方 ...
- keil结合st-link使用SWO的两种调试方法笔记
通过strongerHuang的教程,实现了SWO的两种调试方法, 1.在keil调试的过程中,使用debug printf viewer打印信息, 2.在STM32 ST-LINK Utility中 ...
- GET和POST是HTTP请求的两种基本方法,区别是什么!?
GET和POST是HTTP请求的两种基本方法,要说它们的区别,接触过WEB开发的人都能说出一二. 最直观的区别就是GET把参数包含在URL中,POST通过request body传递参数. 你可能自己 ...
- angular2系列教程(十)两种启动方法、两个路由服务、引用类型和单例模式的妙用
今天我们要讲的是ng2的路由系统. 例子
- 两种Ajax方法
两种Ajax方法 Ajax是一种用于快速创建动态网页的技术,他通过在后台与服务器进行少量的数据交换,可以实现网页的异步更新,不需要像传统网页那样重新加载页面也可以做到对网页的某部分作出更新,现在这项技 ...
- C#中的两种debug方法
这篇文章主要介绍了C#中的两种debug方法介绍,本文讲解了代码用 #if DEBUG 包裹.利用宏定义两种方法,需要的朋友可以参考下 第一种:需要把调试方法改成debug代码用 #if DEBU ...
随机推荐
- python 练习1(流控制)
#!/usr/bin/python #_*_ coding:utf-8 _*_ #练习题 #1.使用while循环输入 1 2 3 4 5 6 8 9 10 #a.定义一个变量存放数字 #b.用whi ...
- Nodejs使用robot操作鼠标键盘
1.安装robotjs库 前提是配置了cnpm cnpm i robotjs -g 2.如果报错VCBuild.exe,如下可以安装windows-tool MSBUILD : error MSB ...
- Catch That Cow (BFS广搜)
问题描述: Farmer John has been informed of the location of a fugitive cow and wants to catch her immedia ...
- dom反转
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...
- 【论文速读】Shangbang Long_ECCV2018_TextSnake_A Flexible Representation for Detecting Text of Arbitrary Shapes
Shangbang Long_ECCV2018_TextSnake_A Flexible Representation for Detecting Text of Arbitrary Shapes 作 ...
- Linux基础命令---dmeg显示内核输出
dmesg dmesg指令用来打印和控制内核的输出信息,这些信息保存早ring buffer中. 此命令的适用范围:RedHat.RHEL.Ubuntu.CentOS.Fedora.SUSE.open ...
- Java基础总结1
数据类型: byte 1字节 short 2字节 int 4字节 long 8字节 float 4字节 double 8字节 char 2字节 ...
- Centos 7 安装 ELK 5.6.8 及基础的配置
下载 wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.8.rpm wget https://ar ...
- 二.误删除MySQL用户,恢复方法
误删除MySQL用户导致无法进入数据库 一.方法一 1.停止数据库 [root@db02 ~]# /etc/init.d/mysqld stop 2.跳过授权表,跳过网络启动数据库 [root@db0 ...
- 20175312 2018-2019-2 《Java程序设计》第6周学习总结
20175312 2018-2019-2 <Java程序设计>第6周学习总结 教材学习内容总结 已依照蓝墨云班课的要求完成了第七.十章的学习,主要的学习渠道是PPT,和书的课后习题. 总结 ...