Comments (6)
For anyone who runs into this same issue, I was able to wrap the table in a CellMeasurer from react-virtualized which made this seamless.
from fixed-data-table-2.
The most efficient way is to use some heuristic to estimate your given height. In practice, this is hard to nail down. In our application, we ended up allowing users to resize rows and added a text overlay indicating that there was content that was hidden.
You could use some magic in componentDidMount to calculate desired row height and use that. Heres a quick example where rowHeight are generated dynamically: https://jsfiddle.net/c39qj6nd/
I would definitely not recommend if you are worried about performance
from fixed-data-table-2.
@gschwa, are you willing to share some code on how you change the cell's height? Just a simple example.
Thank you.
from fixed-data-table-2.
@LESARQ you can write your own cell measurer with componentDidUpdate and use calc results in Table rowHeightGetter
from fixed-data-table-2.
findLongestValue(arr) {
var lgth = 0;
var longestValue;
for (var i = 0; i < arr.length; i++) {
if (arr[i] && arr[i].length > lgth) {
var lgth = arr[i].length;
longestValue = arr[i];
}
}
return longestValue;
}
getDimensions(txt) {
this.e = document.createElement("span");
this.e.style.fontSize = "12px";
this.e.style.fontFamily = "Signika";
this.e.style.minWidth = "180px";
this.e.style.maxWidth = "400px";
this.e.style.display = "inline-block";
this.e.style.lineHeight = "1.4";
this.e.style.padding = "8px";
this.e.innerHTML = txt;
document.body.appendChild(this.e);
var w = this.e.offsetWidth;
var h = this.e.offsetHeight;
document.body.removeChild(this.e);
return { w, h };
}
I use this combination to get my column widths and row heights. Then you can set a Math.max in your rowHeightGetter to either display the minimum height or the height of the content.
from fixed-data-table-2.
Hey, @tsnevillecom I just ended doing my own table component as simple as I could.
Since I don't need table virtualization in my application, it would be an overkill to use this component.
from fixed-data-table-2.
Related Issues (20)
- Why endRowIndex and firstRowIndex are not passed to onVerticalScroll and onHorizontalScroll? HOT 2
- Does it provide infinite scroll? HOT 1
- Resizable rows? HOT 5
- Need drop and play example HOT 3
- Sometimes when scrolling through table rows, I receive warning: Failed prop type: The prop `index` is marked as required in `FixedDataTableRowImpl`, but its value is `null`. HOT 4
- Check the column/cell visibility HOT 9
- Z-index 1 set on column header causes header to overlap other elements HOT 6
- Vertical scroll bar when we have many columns HOT 2
- Cannot read properties of null (reading 'onWheel') HOT 6
- Cannot read properties of null (reading 'setRoot') HOT 4
- React 18 question HOT 4
- "Global is not defined" in React Vite app HOT 2
- Error when refreshing data in table with "smaller" data HOT 5
- Is there a way to implement multi-level headers in Fixed Data Table 2 HOT 3
- When using variable row heights, setting `scrollTop` doesn't work well. Fix proposed HOT 4
- Resize line not shown when "maxHeight" is set. HOT 2
- Column resize doesn't properly work on mobile HOT 11
- Resize vertical bar public in header_ FixedDataTableColumnResizerLine_ Main positioning is not accurate HOT 4
- "site-dev-server" script doesn't work after upgrading to npm 9.8.0 HOT 4
- Scroll to an exact position when clicking the scrollbar track doesn't work in case of variable row heights and isVerticalScrollExact = true HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fixed-data-table-2.