Code Monkey home page Code Monkey logo

Comments (8)

michelengelen avatar michelengelen commented on August 17, 2024

Hey @MiraHariri ... what component are you referring to? TreeView?

And could you please provide a minimal live example? That would help us a lot in understanding your problem! Thanks! 🙇🏼

from mui-x.

MiraHariri avatar MiraHariri commented on August 17, 2024

@michelengelen I'm referring to columnGroupingModel

<DataGridPremium
  apiRef={apiRef}
  rows={[
    {
      id: "1",
      cost_2022: "20",
      variation_2022_2023: "10",
      cost_2023: "30",
      variation_2023_2024: "20",
      cost_2024: "50",
    },
    {
      id: "2",
      cost_2022: "10",
      variation_2022_2023: "20",
      cost_2023: "30",
      variation_2023_2024: "10",
      cost_2024: "40",
    },
  ]}
  columns={[
    {
      headerName: "ID",
      field: "id",
    },
    {
      headerName: "Cost 2022",
      field: "cost_2022",
    },
    {
      headerName: "Variation 2022 2023",
      field: "variation_2022_2023",
    },
    {
      headerName: "Cost 2023",
      field: "cost_2023",
    },
    {
      headerName: "Variation 2023 2024",
      field: "variation_2023_2024",
    },
    {
      headerName: "Cost 2024",
      field: "cost_2024",
    },
  ]}
  columnGroupingModel={[
    {
      groupId: "2022_2023",
      headerName: "2022 - 2023 Variation",
      children: [
        { field: "cost_2022" },
        { field: "variation_2022_2023" },
        { field: "cost_2023" },
      ],
    },
    {
      groupId: "2023_2024",
      headerName: "2023 - 2024 Variation",
      children: [
        { field: "cost_2023" },
        { field: "variation_2023_2024" },
        { field: "cost_2024" },
      ],
    },
  ]}
/>;


I have the field `cost_2023' is duplicated in the 2 groups

This returned an error that a field can't be in multiple groups

Is there a way to achieve this? or a workaround?

from mui-x.

michelengelen avatar michelengelen commented on August 17, 2024

Hi @MiraHariri ... as the docs state:

:warning: a column can only be associated with one group

So, this is not possible and I am not aware of any workarounds for this. The only thing that you could do is probably duplicate that column, but from the structure of your data I would guess this can get out of hand if you scale this up, right?

from mui-x.

MiraHariri avatar MiraHariri commented on August 17, 2024

Okay, yes I had this option to duplicate data with different column names in mind, and it is doable. But thought if there is a way from the table would be better

Thank you @michelengelen

from mui-x.

michelengelen avatar michelengelen commented on August 17, 2024

Yeah ... it would have been better. If we can help you with anything else please feel free to open up a new issue! Thanks! 🙇🏼

from mui-x.

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

⚠️ This issue has been closed.
If you have a similar problem, please open a new issue and provide details about your specific problem.
If you can provide additional information related to this topic that could help future readers, please feel free to leave a comment.

How did we do @MiraHariri?
Your experience with our support team matters to us. If you have a moment, please share your thoughts through our brief survey.

from mui-x.

michelengelen avatar michelengelen commented on August 17, 2024

Hi @MiraHariri ... well, we can definitely improve on this. On the other hand a built-in solution should be preferred. I will try to improve the workaround, but also add this to the board for the team to build a more profound solution. 💪🏼

from mui-x.

michelengelen avatar michelengelen commented on August 17, 2024

Sry, this is the wrong issue ... the original issue was #12222 ... closing this again

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.