Comments (23)
For anyone who needs a quick fix (not sure how good of a solution this is for all browsers), this codepen was a helpful example for how to implement this through CSS: https://codepen.io/paulobrien/pen/LBrMxa
Applying what the codepen did:
const columns = [
{
title: 'Name',
field: 'fullname',
cellStyle: {
backgroundColor: '#039be5',
color: '#FFF',
position: 'sticky',
left: 0
},
headerStyle: {
backgroundColor: '#039be5',
position: 'sticky',
left: 0,
zIndex: 11
}
}
];
const Table = () => {
return(
<MaterialTable
columns={columns}
data={data}
title={`Demo Title`}
options={{
headerStyle: {
backgroundColor: '#01579b',
color: '#FFF',
position: 'sticky',
top: 0
}
}}
/>
);
}
from material-table.
This is done with 1.57.1
Please check the documentation: https://material-table.com/#/docs/features/fixed-columns
from material-table.
You are right. I will add this feature asap.
from material-table.
+1 to this request
from material-table.
+1 to this request.
from material-table.
+1 :)
from material-table.
Hi,
I researched about this feature to find a effective way. Found a solution:
Drawing table twice and one will be absolute. But i have to make table-layout fixed when table has freezed columns.
Please check datatables solution. And give me your feedback.
https://datatables.net/extensions/fixedcolumns/examples/initialisation/two_columns.html
from material-table.
Ideally freezed columns would work as they do in this demo https://devexpress.github.io/devextreme-reactive/react/grid/demos/featured/tree-data/
Where it has a fixed initial width and allows the user to drag/adjust after it is rendered
from material-table.
@mbrn Why did you hard-code a width
onto every column now, even when we're not using this feature? It's even ahead of the this.props.headerStyle
and columnDef.headerStyle
spreads, so there's no way to fix it when it breaks a custom width
style 😞
from material-table.
no need for now.
from material-table.
This is useful feature to have , @mbrn when will it be landed ?
from material-table.
I opened this issue on the first days of material-table. But i am only one developer of material-table and it is my hobby project. So i can not promise a date about issues. But as you know, i resolve issues, add features day by day :)
from material-table.
@mbrn The intended behaviour is ability to freeze header, footer, columns on the right, columns on the left. This is nessessary when our table has about 30 columns.
In my use case, i have a table with columns like day1, day2,...day31
for a month, so i want to unfreeze those columns, and freeze other columns like first_name, last_name
@mbrn Yup, i think most of serious projects started as a hobby project ;)
from material-table.
+1 to this request
from material-table.
@ALL
Any workarounds in the meantime?
from material-table.
+1 to this request
from material-table.
+1 as well :)
from material-table.
+1
from material-table.
+1 to this request.
from material-table.
+1 to this request.
from material-table.
+1 to this request.
from material-table.
@mbrn , what you had shown in the link is exactly the functionality folks are looking for.
I think that if you want to have also freeze columns on the right(maybe v2), you can work as well. You just put the dynamic table in the middle with the correct width and on the left and right of the dynamic tables you can show the frozen columns.
from material-table.
Yes, the solution you mentioned is perfect. An option prop like this will do -
fixedColumns: {
leftColumns: 2
}
from material-table.
Related Issues (20)
- Expose totalCount in remote data feature HOT 1
- Row Unique Id for MaterialTable v4 HOT 1
- Will there be a support for react 18? HOT 1
- help HOT 1
- Is there any upgrade to MUI v5 and React 18? HOT 3
- cannot read properties of undefined (reading 'editing') material-table HOT 1
- How to override parent/child first cell style? HOT 1
- How can I put a back button next to the title?
- What are the changes needed when using material-table 2.0.5 version with react 18.2?
- Can we have Math.round fixed for the vunerability scan warning
- browser is freezing HOT 1
- Disable default grouping.
- headerStyle is not working.
- Add custom style for the scrollbar
- Filter resets when an action happens
- I want to show count infront of field name in grouping
- Want to add Autocomplete in Show/Hide column menu
- Uncaught TypeError: Cannot read properties of undefined (reading 'saveTooltip')
- Filtering after typing text and pressing the Enter button
- Title: WCAG 4.1.2: Ensures every form element has a label (.PrivateSwitchBase-input-317[value=""][data-indeterminate="false"])
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 material-table.