您的位置:首页 > Web前端 > BootStrap

bootstrap table selectsingle

2017-09-28 13:43 288 查看
<!DOCTYPE html>

 
<html>

 
<head>

 
<title>getSelections</title>

 
<meta charset="utf-8">

 
<link rel="stylesheet" href="../assets/bootstrap/css/bootstrap.min.css">

 
<link rel="stylesheet" href="../assets/bootstrap-table/src/bootstrap-table.css">

 
<link rel="stylesheet" href="../assets/examples.css">

 
<script src="../assets/jquery.min.js"></script>

 
<script src="../assets/bootstrap/js/bootstrap.min.js"></script>

 
<script src="../assets/bootstrap-table/src
4000
/bootstrap-table.js"></script>

 
<script src="../ga.js"></script>

 
</head>

 
<body>

 
<div class="container">

 
<h1>getSelections</h1>

 
<p>Return all selected rows, when no record selected, am empty array will return: <code>$table.bootstrapTable('getSelections');</code></p>

 
<div id="toolbar">

 
<button id="button" class="btn
btn-default">getSelections</button>

 
</div>

 
<table id="table"

 
data-toggle="table"

 
data-toolbar="#toolbar"

 
data-height="460"

 
data-click-to-select="true"

 
data-url="../json/data1.json">

 
<thead>

 
<tr>

 
<th data-field="state" data-checkbox="true"></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 $table
= $('#table'),

 
$button = $('#button');

 
 

 
$(function () {

 
$button.click(function () {

 
alert('getSelections: ' + JSON.stringify($table.bootstrapTable('getSelections')));

 
});

 
});

 
</script>

 
</body>

 
</html>

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: