码迷,mamicode.com
首页 > 其他好文 > 详细

datables

时间:2016-10-01 12:19:01      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:

https://editor.datatables.net/examples/styling/bootstrap.html

 

https://datatables.net/forums/discussion/29319/new-rowsgroup-plugin-merge-cells-vertically-rowspan

 

https://github.com/ashl1/datatables-rowsgroup/blob/master/example.html

 

 

 

<html>
<head>
<link rel="stylesheet" href="http://cdn.datatables.net/1.10.7/css/jquery.dataTables.min.css">

<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="http://cdn.datatables.net/1.10.7/js/jquery.dataTables.js"></script>
<script src="dataTables.rowsGroup.js"></script>
</head>
<body>
<button id="update_btn">Manual remerge cells</button>
<table id="example"></table>
<table id="example1"></table>
<script>
$(function(){
var data = [
[‘subgroupN‘, ‘Group1‘, ‘sub-subgroupN‘, ‘ElementN‘, ‘2Element N‘],
[‘subgroup1‘, ‘Group2‘, ‘sub-subgroup1‘, ‘Element1‘, ‘2Element 1‘],
[‘subgroup2‘, ‘Group2‘, ‘sub-subgroup1‘, ‘Element1‘, ‘2Element 1‘],
[‘subgroup2‘, ‘Group2‘, ‘sub-subgroup1‘, ‘Element2‘, ‘2Element 2‘],
[‘subgroup2‘, ‘Group2‘, ‘sub-subgroup2‘, ‘Element3‘, ‘2Element 2‘],
[‘subgroup2‘, ‘Group2‘, ‘sub-subgroup2‘, ‘Element4‘, ‘2Element 4‘],
[‘subgroup2‘, ‘Group2‘, ‘sub-subgroup2‘, ‘Element2‘, ‘2Element 2‘],
[‘subgroup3‘, ‘Group1‘, ‘sub-subgroup1‘, ‘Element1‘, ‘2Element 1‘],
[‘subgroup3‘, ‘Group1‘, ‘sub-subgroup1‘, ‘Element1‘, ‘2Element 1‘],
[‘subgroup2‘, ‘Group2‘, ‘sub-subgroup2‘, ‘Element1‘, ‘2Element 1‘],
[‘subgroup4‘, ‘Group2‘, ‘sub-subgroup2‘, ‘Element1‘, ‘2Element 1‘],
[‘subgroup4‘, ‘Group2‘, ‘sub-subgroup3‘, ‘Element10‘, ‘2Element 17‘],
[‘subgroup4‘, ‘Group2‘, ‘sub-subgroup3‘, ‘Element231‘, ‘2Element 211‘],

]
var table = $(‘#example‘).DataTable({
"iDisplayLength" : 8,
columns: [
{
title: ‘First group‘,
},
{
name: ‘second‘,
title: ‘Second group [order first]‘,
},
{
title: ‘Third group‘,
},
{
title: ‘Forth ungrouped‘,
},
{
title: ‘Fifth ungrouped‘,
},
],
data: data,
/*lengthChange: false,
searching: true,
paging: true,
order: [],*/
rowsGroup: [// Always the array (!) of the column-selectors in specified order to which rows groupping is applied
// (column-selector could be any of specified in https://datatables.net/reference/type/column-selector)
0
],
})
/*table.draw(false);
$(‘#update_btn‘).click(function(){
table.rowsgroup.update();
})*/

var table1 = $(‘#example1‘).DataTable({
"iDisplayLength" : 8,
columns: [
{
title: ‘First group‘,
},
{
name: ‘second‘,
title: ‘Second group [order first]‘,
},
{
title: ‘Third group‘,
},
{
title: ‘Forth ungrouped‘,
},
{
title: ‘Fifth ungrouped‘,
},
],
data: data,
/*lengthChange: false,
searching: true,
paging: true,
order: [],*/
rowsGroup: [// Always the array (!) of the column-selectors in specified order to which rows groupping is applied
// (column-selector could be any of specified in https://datatables.net/reference/type/column-selector)
0
],
})
/*table1.draw(false);*/
/*$(‘#update_btn‘).click(function(){
table.rowsgroup.update();
})*/


});
</script>
</body>
</html>

datables

标签:

原文地址:http://www.cnblogs.com/sunhai2016/p/5925523.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!