3 var FrozenRows =
function FrozenRows(table) {
5 this.topElement = document.createElement(
"div");
10 FrozenRows.prototype.initialize =
function () {
13 this.topElement.classList.add(
"tabulator-frozen-rows-holder");
16 this.table.columnManager.getElement().insertBefore(this.topElement, this.table.columnManager.headersElement.nextSibling);
19 FrozenRows.prototype.setDisplayIndex =
function (index) {
20 this.displayIndex = index;
23 FrozenRows.prototype.getDisplayIndex =
function () {
24 return this.displayIndex;
27 FrozenRows.prototype.isFrozen =
function () {
28 return !!this.rows.length;
32 FrozenRows.prototype.getRows =
function (rows) {
35 output = rows.slice(0);
37 this.rows.forEach(
function (row) {
38 var index = output.indexOf(row);
41 output.splice(index, 1);
48 FrozenRows.prototype.freezeRow =
function (row) {
49 if (!row.modules.frozen) {
50 row.modules.frozen =
true;
51 this.topElement.appendChild(row.getElement());
53 row.normalizeHeight();
54 this.table.rowManager.adjustTableSize();
58 this.table.rowManager.refreshActiveData(
"display");
62 console.warn(
"Freeze Error - Row is already frozen");
66 FrozenRows.prototype.unfreezeRow =
function (row) {
67 var index = this.rows.indexOf(row);
69 if (row.modules.frozen) {
71 row.modules.frozen =
false;
73 var rowEl = row.getElement();
74 rowEl.parentNode.removeChild(rowEl);
76 this.table.rowManager.adjustTableSize();
78 this.rows.splice(index, 1);
80 this.table.rowManager.refreshActiveData(
"display");
82 if (this.rows.length) {
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);
98 Tabulator.prototype.registerModule(
"frozenRows", FrozenRows);