Code Monkey home page Code Monkey logo

Comments (9)

MBilalShafi avatar MBilalShafi commented on August 26, 2024 1

feels incoherent to have one prop be affected by it and the other not.

Sounds good to me on a rethought. I was relating it more to a fixed height value (just like we set using CSS), but for an internal prop, I agree that honoring the density does make sense.

from mui-x.

michelengelen avatar michelengelen commented on August 26, 2024

Changing the height on the header filter row can be done like this:

<DataGridPremium
  columns={columns}
  rows={rows}
  headerFilters
  sx={{
    [`& .${gridClasses.headerFilterRow}`]: {
      height: 200,
    },
  }}
/>

This will result in this:

Screenshot 2024-04-03 at 15 48 20

I do agree although that the columnHeaderHeight prop will restrict the column header height when not overwritten with sx as well. If your implementation allows for that you can also do this via sx:

sx={{
  [`& .${gridClasses.columnHeader}`]: {
    height: 100,
  },
  [`& .${gridClasses.headerFilterRow}`]: {
    height: 200,
  },
}}

Does this help your use case?

from mui-x.

michelengelen avatar michelengelen commented on August 26, 2024

@cherniavskii should we add this to the board to explore 2 separate props columnHeaderHeight and columnHeaderFilterHeight?

from mui-x.

layerok avatar layerok commented on August 26, 2024

@michelengelen Thanks for the answer. It kind of works. But the header filter cell does not stretch to fit the height of the parent element.

image

To fix this I had to add one more css rule

sx={{
  [`& .${gridClasses.columnHeader}`]: {
    height: 40,
  },
  [`& .${gridClasses.headerFilterRow}`]: {
    height: 52,
    [`& .${gridClasses.columnHeader}`]: {
      height: "100%!important",
    },
  },
}}

from mui-x.

layerok avatar layerok commented on August 26, 2024

But there is one problem with the current solution.

Now it is possible to scroll the table content even there is enough space to fit all rows. You can see it in the attached video.

I have autoPageSize option turned on.

mui-scrolling-issue.mov

from mui-x.

layerok avatar layerok commented on August 26, 2024

I am guessing this is because we overwrote dimensions only in the CSS, but the dimensions in the internal state were not adjusted accordingly, so features that depend on internal dimensions such as scrolling don't work as expected.

from mui-x.

MBilalShafi avatar MBilalShafi commented on August 26, 2024

Now it is possible to scroll the table content even there is enough space to fit all rows. You can see it in the attached video.

That's because we use fake scrollbars internally and they use a function called getTotalHeaderHeight to compute when to start a scroll. Even if you increase the height using the sx prop, this method will use the standard height resulting in incorrect behavior related to the scrollbar.

export function getTotalHeaderHeight(
apiRef: React.MutableRefObject<GridApiCommunity>,
headerHeight: number,
) {
const densityFactor = gridDensityFactorSelector(apiRef);
const maxDepth = gridColumnGroupsHeaderMaxDepthSelector(apiRef);
const isHeaderFilteringEnabled = gridHeaderFilteringEnabledSelector(apiRef);
const multiplicationFactor = isHeaderFilteringEnabled ? 2 : 1;
return Math.floor(headerHeight * densityFactor) * ((maxDepth ?? 0) + multiplicationFactor);
}

IMO introducing a separate optional prop like columnHeaderFilterRowHeight could be a possible solution.
It could default to columnHeaderHeight if not provided.

Since it will be kind of an override, I'd prefer not to take into account the densityFactor once it's provided.

Wdyt @mui/xgrid?

from mui-x.

romgrk avatar romgrk commented on August 26, 2024

Yes, columnHeaderFilterHeight sounds good to me. Not sure about density, feels incoherent to have one prop be affected by it and the other not.

from mui-x.

github-actions avatar github-actions commented on August 26, 2024

⚠️ This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

@layerok: How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.

from mui-x.

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.