110 lines
3.8 KiB
HTML
110 lines
3.8 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<link rel="stylesheet" type="text/css" href="treegrid.css" />
|
|
<script type="text/javascript" src="util.js"></script>
|
|
<script type="text/javascript" src="treegrid.js"></script>
|
|
<style>
|
|
table, tr, td, th { box-sizing: border-box; background: white; }
|
|
table { border-collapse: separate; border-spacing: 0px; }
|
|
th, td { border-width: 0 1px 1px 0 !important; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<script>
|
|
<!--
|
|
(function()
|
|
{
|
|
var items = [];
|
|
for (var i = 0; i < 1000; i++)
|
|
{
|
|
items[i] = {
|
|
data: [ 'Payment from Gazprom to Shell '+i, (Math.random()+'').substr(0, 6), '', (Math.random()+'').substr(0, 6) ],
|
|
collapsed: true,
|
|
children: []
|
|
};
|
|
for (var j = 0; j < 5; j++)
|
|
{
|
|
items[i].children[j] = {
|
|
data: [ 'Subpayment '+i+' / '+j, 231, 231 ],
|
|
leaf: true
|
|
};
|
|
}
|
|
}
|
|
//var TG = window.TG = new TreeGrid({ header: [], items: [], bind: { rowSpan: true }, stickyHeaders: true, stickyColumnWidth: '200px', renderer: function(node)
|
|
var TG = window.TG = new TreeGrid({ header: [
|
|
'', '15 фев', '16 фев', '17 фев', '18 фев'
|
|
], items: items, bind: { rowSpan: true }, stickyHeaders: true, stickyColumnWidth: '200px', renderer: function(node)
|
|
{
|
|
var cells = [];
|
|
for (var i = 0; i < node.data.length; i++)
|
|
cells[i] = { innerHTML: node.data[i] };
|
|
if (node.tr.length == 2)
|
|
{
|
|
cells = [ cells.slice(0), cells.slice(0) ];
|
|
// cells[0][0].rowSpan = 2;
|
|
// cells[1][0] = { style: 'display: none' };
|
|
}
|
|
return cells;
|
|
} });
|
|
document.body.appendChild(TG.wrapper||TG.table);
|
|
TG.syncView();
|
|
/*setTimeout(function() {
|
|
TG.setHeader([ '', '15 фев', '16 фев', '17 фев', '18 фев', '19 фев', '20 фев', '21 фев', '15 фев', '16 фев', '17 фев', '18 фев', '19 фев', '20 фев', '21 фев', '15 фев', '16 фев', '17 фев', '18 фев', '19 фев', '20 фев', '21 фев', '15 фев', '16 фев', '17 фев', '18 фев', '19 фев', '20 фев', '21 фев' ]);
|
|
TG.root.setChildren(false, [ {
|
|
data: [ 'Payment from Gazprom to Shell', '2', '3' ],
|
|
children: [ {
|
|
data: [ 'Payment from Gazprom to Shell', '2', '3' ],
|
|
}, {
|
|
data: [ 'Payment from Gazprom to Shell', '2', '31203' ],
|
|
rows: 2
|
|
}, {
|
|
data: [ 'Payment from Gazprom to Shell', '2', '329x<br>2' ]
|
|
}, {
|
|
data: [ 'Payment from Gazprom to Shell', '2', '239000' ]
|
|
}, {
|
|
data: [ 'Payment from Gazprom to Shell', '2', 'aaaaa' ]
|
|
} ]
|
|
}, {
|
|
data: [ 'Payment from Gazprom to Shell', '2', '31203' ],
|
|
rows: 2
|
|
}, {
|
|
data: [ 'Payment from Gazprom to Shell', '2', '329x<br>2' ]
|
|
}, {
|
|
data: [ 'Payment from Gazprom to Shell', '2', '239000' ]
|
|
}, {
|
|
data: [ 'Payment from Gazprom to Shell', '2', 'aaaaa' ]
|
|
} ]);
|
|
}, 1000);
|
|
TG.onExpand = function(node)
|
|
{
|
|
// Dynamic loading example
|
|
if (!node.children.length)
|
|
node.setChildren(false, [ i ]);
|
|
return true;
|
|
|
|
// Another example with delay (emulation of server interaction)
|
|
setTimeout(function() {
|
|
if (!node.children.length)
|
|
node.setChildren(false, [ i ]);
|
|
node.toggle();
|
|
}, 100);
|
|
return false;
|
|
};
|
|
|
|
// Cell editing example
|
|
TG.initCellEditing();
|
|
|
|
// Cell selection by mouse drag example
|
|
TG.initCellSelection(true);
|
|
TG.onCellSelect = function(node, i, td)
|
|
{
|
|
return i > 0;
|
|
};*/
|
|
})();
|
|
//-->
|
|
</script>
|
|
</body>
|
|
</html>
|