Git Product home page Git Product logo

Comments (23)

joshling1919 avatar joshling1919 commented on July 21, 2024 17

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.

mbrn avatar mbrn commented on July 21, 2024 11

This is done with 1.57.1

Please check the documentation: https://material-table.com/#/docs/features/fixed-columns

from material-table.

mbrn avatar mbrn commented on July 21, 2024 8

You are right. I will add this feature asap.

from material-table.

feleko avatar feleko commented on July 21, 2024 8

+1 to this request

from material-table.

krunalsheth3 avatar krunalsheth3 commented on July 21, 2024 7

+1 to this request.

from material-table.

JKrymarys avatar JKrymarys commented on July 21, 2024 6

+1 :)

from material-table.

mbrn avatar mbrn commented on July 21, 2024 3

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.

urirahimi avatar urirahimi commented on July 21, 2024 1

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.

vdh avatar vdh commented on July 21, 2024 1

@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.

mbrn avatar mbrn commented on July 21, 2024

no need for now.

from material-table.

revskill10 avatar revskill10 commented on July 21, 2024

This is useful feature to have , @mbrn when will it be landed ?

from material-table.

mbrn avatar mbrn commented on July 21, 2024

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.

revskill10 avatar revskill10 commented on July 21, 2024

@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.

MaxGorshkov avatar MaxGorshkov commented on July 21, 2024

+1 to this request

from material-table.

JKrymarys avatar JKrymarys commented on July 21, 2024

@ALL
Any workarounds in the meantime?

from material-table.

ysmike avatar ysmike commented on July 21, 2024

+1 to this request

from material-table.

PrincAm avatar PrincAm commented on July 21, 2024

+1 as well :)

from material-table.

yagofrancia avatar yagofrancia commented on July 21, 2024

+1

from material-table.

philg74 avatar philg74 commented on July 21, 2024

+1 to this request.

from material-table.

nisarg271 avatar nisarg271 commented on July 21, 2024

+1 to this request.

from material-table.

NickAlvesX avatar NickAlvesX commented on July 21, 2024

+1 to this request.

from material-table.

gabriel-kohen-by avatar gabriel-kohen-by commented on July 21, 2024

@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.

codenamethanos avatar codenamethanos commented on July 21, 2024

Yes, the solution you mentioned is perfect. An option prop like this will do -

fixedColumns:   {
            leftColumns: 2
}

from material-table.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.