bootstrap实现列的拖动

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css"/>

<style type="text/css">
*{margin: 0;padding: 0;}

</style>
</head>
<body>
<div class="tableArea ">
<table class="table table-striped" id="table" data-height="600">
<!--在此处填充表格数据-->
</table>
</div>

<script src="js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
<!--<script src="js/bootstrap-table-reorder-rows.js" type="text/javascript" charset="utf-8"></script>-->
<script src="js/bootstrap-table.js" type="text/javascript" charset="utf-8"></script>
<!--<script src="js/jquery.tablednd.min.js" type="text/javascript" charset="utf-8"></script>-->
<!--<script src="js/bootstrap-table-reorder-columns.min.js" type="text/javascript" charset="utf-8"></script>-->
<script type="text/javascript" src="js/bootstrap-table-resizable.min.js"></script>
<script type="text/javascript" src="js/colResizable-1.6.min.js"></script>

<script type="text/javascript">
var $table = $('#table');//绑定表格id
$(function () {
buildTable($table, 24, 24); //设置所要加载的表格列数和行数,此处为24行24列
});
//生成很多个表
function buildTable($el, cells, rows) {
var i, j, row,
columns = [],
data = [];

for (i = 0; i < cells; i++) {
columns.push({
field: 'field' + i,
title: 'Cell' + i,
sortable: true
});
}
for (i = 0; i < rows; i++) {
row = {};
for (j = 0; j < cells; j++) {
row['field' + j] = 'Row-' + i + '-' + j;
}
data.push(row);
}
$el.bootstrapTable('destroy').bootstrapTable({
columns: columns,
data: data,
search: true,
toolbar: '.toolbar',
});
}

//实现列的拖动
$(function(){
$("#table").colResizable({
liveDrag:true,
gripInnerHtml:"<div class='grip'></div>",
draggingClass:"dragging",
resizeMode:'fit'
});
});
</script>
</script>
</body>
</html>

上一篇:NOIP2003 传染病防治


下一篇:【LeetCode】131. Palindrome Partitioning