Make FHT refresh header on each setup call
parent
28f2a68d9a
commit
a718b47be7
14
treegrid.js
14
treegrid.js
|
@ -47,7 +47,7 @@ TreeGrid.prototype.setHeader = function(newHeader)
|
|||
this.header = newHeader;
|
||||
// header change clears the whole grid by now
|
||||
if (this.root)
|
||||
this.root.setChildren([]);
|
||||
this.root.setChildren(false, []);
|
||||
}
|
||||
|
||||
TreeGrid.prototype.onExpand = function(node)
|
||||
|
@ -159,16 +159,18 @@ TreeGridNode.prototype.toggle = function()
|
|||
|
||||
TreeGridNode.prototype.setChildren = function(isLeaf, newChildren)
|
||||
{
|
||||
this.leaf = isLeaf;
|
||||
if (!this.tr)
|
||||
this.grid.tbody.innerHTML = '';
|
||||
else
|
||||
{
|
||||
while (this.tr.nextSibling && this.tr.nextSibling._node.level > this.level)
|
||||
this.grid.tbody.removeChild(this.tr.nextSibling);
|
||||
this.leaf = isLeaf;
|
||||
if (this.leaf)
|
||||
this.tr.cells[0].firstChild.className = 'collapser collapser-inactive';
|
||||
else
|
||||
this.tr.cells[0].firstChild.className = this.collapsed ? 'collapser collapser-collapsed' : 'collapser collapser-expanded';
|
||||
if (this.leaf)
|
||||
this.tr.cells[0].firstChild.className = 'collapser collapser-inactive';
|
||||
else
|
||||
this.tr.cells[0].firstChild.className = this.collapsed ? 'collapser collapser-collapsed' : 'collapser collapser-expanded';
|
||||
}
|
||||
this.children = [];
|
||||
var insertBefore = this.tr && this.tr.nextSibling;
|
||||
for (var i = 0; i < newChildren.length; i++)
|
||||
|
|
|
@ -19,10 +19,17 @@ onDomReady(function()
|
|||
var i = {
|
||||
cells: [ 'Payment from Gazprom to Shell 2', '4', '5' ]
|
||||
};
|
||||
var TG = new TreeGrid([ {
|
||||
cells: [ 'Payment from Gazprom to Shell', '2', '3' ]
|
||||
} ], [ '', '15 фев', '16 фев', '17 фев', '18 фев', '19 фев', '20 фев', '21 фев' ]);
|
||||
var TG = new TreeGrid([], []);
|
||||
TG.table.className = 'grid';
|
||||
document.getElementById('innerdiv').appendChild(TG.table);
|
||||
$(TG.table).fixedHeaderTable({});
|
||||
setTimeout(function() {
|
||||
TG.setHeader([ '', '15 фев', '16 фев', '17 фев', '18 фев', '19 фев', '20 фев', '21 фев' ]);
|
||||
TG.root.setChildren(false, [ {
|
||||
cells: [ 'Payment from Gazprom to Shell', '2', '3' ]
|
||||
} ]);
|
||||
$(TG.table).fixedHeaderTable({});
|
||||
}, 1000);
|
||||
TG.onExpand = function(node)
|
||||
{
|
||||
// Dynamic loading example
|
||||
|
@ -38,8 +45,6 @@ onDomReady(function()
|
|||
}, 100);
|
||||
return false;
|
||||
};
|
||||
document.getElementById('innerdiv').appendChild(TG.table);
|
||||
$(TG.table).fixedHeaderTable({});
|
||||
|
||||
// Cell editing example
|
||||
$(TG.table).dblclick(function(evt)
|
||||
|
|
Loading…
Reference in New Issue