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 ...
随机推荐
- git之commit
面解释的话, 1.git commit -m用于提交暂存区的文件: 2.git commit -am用于提交跟踪过的文件. 要理解它们的区别,首先要明白git的文件状态变化周期,如下图所示 工作目录下 ...
- cygwin vim can't write .viminfo
问题 每次退出vim时,都提示 vim can't wirte .viminfo 运行环境 以管理员身份登录win7,并运行cygwin 排查过程 切换到家目录,查看发现.viminfo文件存在. 查 ...
- OAuth授权 | 把这一篇丢给他
OAuth授权 一.背景 上一篇我们介绍了单点登录(SSO),它能够实现多个系统的统一认证.今天我们来谈一谈近几年来非常流行的,大名鼎鼎的OAuth.它也能完成 统一认证,而且还能做更多的事情.至于O ...
- 百度API经纬度和地址互相查询
/** * 获取地址对应的坐标 * @param $address * @return array */ function getAddressPoint($address){ $lng = 0; $ ...
- px和em的区别, css权重
PX特点:px像素(Pixel).相对长度单位.像素px是相对于显示器屏幕分辨率而言的. EM特点 1. em的值并不是固定的:2. em会继承父级元素的字体大小. 优先级:!important> ...
- go语言time包的使用
时间类型 time.Time类型表示时间. //时间类型 func timeDemo() { now := time.Now() fmt.Println(now) //2019-04-20 13:52 ...
- Liunx中fstab文件详解
Liunx中fstab文件详解 /etc/fstab是用来存放文件系统的静态信息的文件.位于/etc/目录下,可以用命令less /etc/fstab 来查看,如果要修改的话,则用命令 vi /etc ...
- zabbix监控服务搭建
命令配置 浏览器配置: 检查必须全部ok(若有warning,检查是否漏装包,重启php-fpm服务) 数据库信息 主机名(zabbix server ip).端口号(默认).名字(随意) 配置摘要 ...
- lnmp mysql远程访问设置
一:iptables 设置开放3306访问 iptables -L -n --line-numbers 1,删除DROP 3306 iptables -D INPUT 5[序列号] 2,添加 ACCE ...
- what i want
i want to be the object of every beautiful creature. they strongly want to talk with me, and study f ...