react-sticky-table
Advanced tools
Comparing version 1.0.1 to 1.0.3
@@ -110,2 +110,5 @@ (function (global, factory) { | ||
_this.stickyColumnCount = props.stickyColumnCount === 0 ? 0 : _this.stickyHeaderCount || 1; | ||
_this.stickyHeaderCount = props.stickyHeaderCount === 0 ? 0 : _this.stickyHeaderCount || 1; | ||
_this.onResize = _this.onResize.bind(_this); | ||
@@ -173,9 +176,11 @@ _this.onColumnResize = _this.onColumnResize.bind(_this); | ||
for (r = 0; r < this.rowCount; r++) { | ||
cellToCopy = this.table.querySelector('#sticky-table-x-wrapper').firstChild.childNodes[r].firstChild; | ||
if (this.stickyColumnCount) { | ||
for (r = 0; r < this.rowCount; r++) { | ||
cellToCopy = this.table.querySelector('#sticky-table-x-wrapper').firstChild.childNodes[r].firstChild; | ||
if (cellToCopy) { | ||
height = this.getSizeWithoutBoxSizing(cellToCopy).height; | ||
if (cellToCopy) { | ||
height = this.getSizeWithoutBoxSizing(cellToCopy).height; | ||
this.table.querySelector('#sticky-column').firstChild.childNodes[r].firstChild.style.height = height + 'px'; | ||
this.table.querySelector('#sticky-column').firstChild.childNodes[r].firstChild.style.height = height + 'px'; | ||
} | ||
} | ||
@@ -189,11 +194,13 @@ } | ||
for (c = 0; c < this.columnCount; c++) { | ||
cellToCopy = this.table.querySelector('#sticky-table-x-wrapper').firstChild.firstChild.childNodes[c]; | ||
if (this.stickyHeaderCount) { | ||
for (c = 0; c < this.columnCount; c++) { | ||
cellToCopy = this.table.querySelector('#sticky-table-x-wrapper').firstChild.firstChild.childNodes[c]; | ||
if (cellToCopy) { | ||
width = this.getSizeWithoutBoxSizing(cellToCopy).width; | ||
cell = this.table.querySelector('#sticky-header-cell-' + c); | ||
if (cellToCopy) { | ||
width = this.getSizeWithoutBoxSizing(cellToCopy).width; | ||
cell = this.table.querySelector('#sticky-header-cell-' + c); | ||
cell.style.width = width + 'px'; | ||
cell.style.minWidth = width + 'px'; | ||
cell.style.width = width + 'px'; | ||
cell.style.minWidth = width + 'px'; | ||
} | ||
} | ||
@@ -263,4 +270,8 @@ } | ||
if (rows.length) { | ||
stickyColumn = this.getStickyColumn(rows); | ||
stickyHeader = this.getStickyHeader(rows); | ||
if (this.stickyColumnCount > 0) { | ||
stickyColumn = this.getStickyColumn(rows); | ||
} | ||
if (this.stickyHeaderCount > 0) { | ||
stickyHeader = this.getStickyHeader(rows); | ||
} | ||
} | ||
@@ -267,0 +278,0 @@ |
{ | ||
"name": "react-sticky-table", | ||
"version": "1.0.1", | ||
"version": "1.0.3", | ||
"description": "Dynamically sized fixed header and column for tables", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -9,5 +9,5 @@ # Sticky Table | ||
### Features | ||
## Features | ||
- Optional fixed columns & headers | ||
- Optional fixed column & header | ||
- Responsive table dimensions (wrap it in any size container and it will fill that container) | ||
@@ -20,7 +20,7 @@ - Dynamic row height & column width (no need to specify width and height in pixels) | ||
Doesn't yet support: Multiple columns/headers, Client side sorting, or IE <= 7. | ||
Doesn't yet support: Multiple columns/headers, client side sorting, or IE <= 7. | ||
### Getting Started | ||
## Getting Started | ||
Install fixed-data-table using npm. | ||
Install react-sticky-table using npm. | ||
@@ -31,3 +31,3 @@ `npm install react-sticky-table --save` | ||
### Example | ||
## Example | ||
``` | ||
@@ -61,3 +61,3 @@ import React, { Component } from 'react'; | ||
### License | ||
## License | ||
@@ -64,0 +64,0 @@ (The MIT License) |
@@ -27,2 +27,5 @@ import React, { Component, PropTypes } from 'react'; | ||
this.stickyColumnCount = props.stickyColumnCount === 0 ? 0 : (this.stickyHeaderCount || 1); | ||
this.stickyHeaderCount = props.stickyHeaderCount === 0 ? 0 : (this.stickyHeaderCount || 1); | ||
this.onResize = this.onResize.bind(this); | ||
@@ -76,3 +79,3 @@ this.onColumnResize = this.onColumnResize.bind(this); | ||
var dims = this.getSizeWithoutBoxSizing(columnCell); | ||
if (cell) { | ||
@@ -95,9 +98,11 @@ cell.style.width = dims.width + 'px'; | ||
for (r = 0; r < this.rowCount; r++) { | ||
cellToCopy = this.table.querySelector('#sticky-table-x-wrapper').firstChild.childNodes[r].firstChild; | ||
if (this.stickyColumnCount) { | ||
for (r = 0; r < this.rowCount; r++) { | ||
cellToCopy = this.table.querySelector('#sticky-table-x-wrapper').firstChild.childNodes[r].firstChild; | ||
if (cellToCopy) { | ||
height = this.getSizeWithoutBoxSizing(cellToCopy).height; | ||
if (cellToCopy) { | ||
height = this.getSizeWithoutBoxSizing(cellToCopy).height; | ||
this.table.querySelector('#sticky-column').firstChild.childNodes[r].firstChild.style.height = height + 'px'; | ||
this.table.querySelector('#sticky-column').firstChild.childNodes[r].firstChild.style.height = height + 'px'; | ||
} | ||
} | ||
@@ -114,11 +119,13 @@ } | ||
for (c = 0; c < this.columnCount; c++) { | ||
cellToCopy = this.table.querySelector('#sticky-table-x-wrapper').firstChild.firstChild.childNodes[c]; | ||
if (this.stickyHeaderCount) { | ||
for (c = 0; c < this.columnCount; c++) { | ||
cellToCopy = this.table.querySelector('#sticky-table-x-wrapper').firstChild.firstChild.childNodes[c]; | ||
if (cellToCopy) { | ||
width = this.getSizeWithoutBoxSizing(cellToCopy).width; | ||
cell = this.table.querySelector('#sticky-header-cell-' + c); | ||
if (cellToCopy) { | ||
width = this.getSizeWithoutBoxSizing(cellToCopy).width; | ||
cell = this.table.querySelector('#sticky-header-cell-' + c); | ||
cell.style.width = width + 'px'; | ||
cell.style.minWidth = width + 'px'; | ||
cell.style.width = width + 'px'; | ||
cell.style.minWidth = width + 'px'; | ||
} | ||
} | ||
@@ -212,4 +219,8 @@ } | ||
if (rows.length) { | ||
stickyColumn = this.getStickyColumn(rows); | ||
stickyHeader = this.getStickyHeader(rows); | ||
if (this.stickyColumnCount > 0) { | ||
stickyColumn = this.getStickyColumn(rows); | ||
} | ||
if (this.stickyHeaderCount > 0) { | ||
stickyHeader = this.getStickyHeader(rows); | ||
} | ||
} | ||
@@ -226,10 +237,6 @@ | ||
<div className='sticky-column' id='sticky-column'> | ||
<Table> | ||
{stickyColumn} | ||
</Table> | ||
<Table>{stickyColumn}</Table> | ||
</div> | ||
<div className='sticky-table-x-wrapper' id='sticky-table-x-wrapper'> | ||
<Table> | ||
{rows} | ||
</Table> | ||
<Table>{rows}</Table> | ||
</div> | ||
@@ -236,0 +243,0 @@ </div> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38150
927