1 var FrozenRows =
function(table){
3 this.topElement = document.createElement(
"div");
8 FrozenRows.prototype.initialize =
function(){
11 this.topElement.classList.add(
"tabulator-frozen-rows-holder");
14 this.table.columnManager.getElement().insertBefore(this.topElement, this.table.columnManager.headersElement.nextSibling);
17 FrozenRows.prototype.setDisplayIndex =
function(index){
18 this.displayIndex = index;
21 FrozenRows.prototype.getDisplayIndex =
function(){
22 return this.displayIndex;
25 FrozenRows.prototype.isFrozen =
function(){
26 return !!this.rows.length;
30 FrozenRows.prototype.getRows =
function(rows){
33 output = rows.slice(0);
35 this.rows.forEach(
function(row){
36 var index = output.indexOf(row);
39 output.splice(index, 1);
46 FrozenRows.prototype.freezeRow =
function(row){
47 if(!row.modules.frozen){
48 row.modules.frozen =
true;
49 this.topElement.appendChild(row.getElement());
51 row.normalizeHeight();
52 this.table.rowManager.adjustTableSize();
56 this.table.rowManager.refreshActiveData(
"display");
61 console.warn(
"Freeze Error - Row is already frozen");
65 FrozenRows.prototype.unfreezeRow =
function(row){
66 var index = this.rows.indexOf(row);
68 if(row.modules.frozen){
70 row.modules.frozen =
false;
72 var rowEl = row.getElement();
73 rowEl.parentNode.removeChild(rowEl);
75 this.table.rowManager.adjustTableSize();
77 this.rows.splice(index, 1);
79 this.table.rowManager.refreshActiveData(
"display");
86 console.warn(
"Freeze Error - Row is already unfrozen");
90 FrozenRows.prototype.styleRows =
function(row){
93 this.rows.forEach(
function(row, i){
94 self.table.rowManager.styleRow(row, i);
99 Tabulator.prototype.registerModule(
"frozenRows", FrozenRows);