bootstrap table 单击获取当前行号
来源:互联网 发布:百世快递软件 编辑:程序博客网 时间:2024/06/04 18:57
主要方法是
//单击事件获取当前行号
$('#bootstrapTable').on("click-row.bs.table",function(e, row, $element) {
var index= $element.data('index');
});
示例代码
<!DOCTYPE html>
<html>
<head>
<title>getSelections</title>
<meta charset="utf-8">
<link rel="stylesheet" href="http://issues.wenzhixin.net.cn/bootstrap-table/assets/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="http://issues.wenzhixin.net.cn/bootstrap-table/assets/bootstrap-table/src/bootstrap-table.css">
<link rel="stylesheet" href="http://issues.wenzhixin.net.cn/bootstrap-table/assets/examples.css">
<script src="http://issues.wenzhixin.net.cn/bootstrap-table/assets/jquery.min.js"></script>
<script src="http://issues.wenzhixin.net.cn/bootstrap-table/assets/bootstrap/js/bootstrap.min.js"></script>
<script src="http://issues.wenzhixin.net.cn/bootstrap-table/assets/bootstrap-table/src/bootstrap-table.js"></script>
<script src="http://issues.wenzhixin.net.cn/bootstrap-table/ga.js"></script>
</head>
<body>
<div class="container">
<h1>获取bootstrap table 当前所在行号</h1>
<table id="table"
data-toggle="table"
data-toolbar="#toolbar"
data-height="460"
data-click-to-select="true"
>
<thead>
<tr>
<th data-field="state" data-checkbox="true" data-visible="false" ></th>
<th data-field="id">ID</th>
<th data-field="name">Item Name</th>
<th data-field="price">Item Price</th>
</tr>
</thead>
</table>
</div>
<script>
var data =[
{
"id": 0,
"name": "张国荣",
"price": "$0"
},
{
"id": 1,
"name": "周杰伦",
"price": "$1"
},
{
"id": 2,
"name": "玛蒂娜",
"price": "$2"
},
{
"id": 3,
"name": "张飞",
"price": "$3"
},
{
"id": 4,
"name": "关羽",
"price": "$4"
},
{
"id": 5,
"name": "刘翔",
"price": "$5"
},
{
"id": 6,
"name": "史泰龙",
"price": "$6"
},
{
"id": 7,
"name": "李小龙",
"price": "$7"
},
{
"id": 8,
"name": "奔驰",
"price": "$8"
},
{
"id": 9,
"name": "奥迪",
"price": "$9"
},
{
"id": 10,
"name": "Item 10",
"price": "$10"
},
{
"id": 11,
"name": "Item 11",
"price": "$11"
},
{
"id": 12,
"name": "Item 12",
"price": "$12"
},
{
"id": 13,
"name": "Item 13",
"price": "$13"
},
{
"id": 14,
"name": "Item 14",
"price": "$14"
},
{
"id": 15,
"name": "Item 15",
"price": "$15"
},
{
"id": 16,
"name": "Item 16",
"price": "$16"
},
{
"id": 17,
"name": "Item 17",
"price": "$17"
},
{
"id": 18,
"name": "Item 18",
"price": "$18"
},
{
"id": 19,
"name": "Item 19",
"price": "$19"
},
{
"id": 20,
"name": "Item 20",
"price": "$20"
}
];
$(function () {
$("#table").bootstrapTable("load",data);
$('#table').on("click-row.bs.table",function(e, row, $element) {
var index= $element.data('index');
alert(index);
});
});
</script>
</body>
</html>
- bootstrap table 单击获取当前行号
- table获取当前行号
- Js获取table中当前选择行号
- bootstrap table 显示行号
- bootstrap-table 显示行号
- bootstrap-table显示行号
- C#获取当前行号
- Bootstrap Table 双击、单击行获取该行内容及自动获取全表的内容
- bootstrap-table 显示行号,分页有效
- bootstrap-table 实现单击单元格可编辑
- bootstrap-table,当前行单击事件
- 获取datalist当前操作行号
- GridView、Repeater获取当前行号
- python 获取当前代码行号
- jquery 单击table获取tr id
- Angularjs bootstrap table多选(全选),支持单击行选中
- mysql获取当前记录所在行号
- listCtrl 获取当前选中的行号
- SpringMVC教程--异常处理器详解
- var result = eval("(" + data + ")"); 这个问题还没有解决 !!!!!!
- File工具类
- HTML5游戏开发的细节问题
- vm虚拟机nat配置外网
- bootstrap table 单击获取当前行号
- jstl c:choose>、<c:when>和<c:otherwise>标签
- Android studio 全工程搜索并替换字符串
- Redis操作
- 异常处理
- 腾讯微信被怼,iOS版微信不能打赏了
- powermock与junit的fixOrder不兼容,解决方式为testAll
- CCF NOI1014 写评语
- 从菜鸟到架构师(十四)