Code Monkey home page Code Monkey logo

Comments (10)

cbrainee avatar cbrainee commented on May 28, 2024 1

@flaviendelangle Thanks for the help and suggestions.

from mui-x.

michelengelen avatar michelengelen commented on May 28, 2024

Hey @cbrainee and thanks for raising an issue here.
Could you please provide us with a minimal working reproduction example?
It's way easier and less error prone if you could do that.

from mui-x.

cbrainee avatar cbrainee commented on May 28, 2024

https://codesandbox.io/p/sandbox/eloquent-voice-lq5rz4?file=%2Fsrc%2FDemo.js%3A18%2C13

from mui-x.

michelengelen avatar michelengelen commented on May 28, 2024

@cbrainee could you make that sandbox public? I cannot access it

from mui-x.

cbrainee avatar cbrainee commented on May 28, 2024

@michelengelen Done

from mui-x.

michelengelen avatar michelengelen commented on May 28, 2024

OK, I see that it is not working the way one would expect.
I am not familiar with how the inner workings of the row grouping look like.
@flaviendelangle you have introduced that feature if I am not mistaken
Could you please have a look here?

from mui-x.

flaviendelangle avatar flaviendelangle commented on May 28, 2024

Hi,

You need to use the groupingValueGetter prop (doc) to retrieve the grouping value.

And if some value have no org, they will remain at the top level (doc).
If you want to group them as well, you must put a default value.

Here is what the final column could look like:

        {
            field: "customerOrg",
            headerName: "Customer Org",
            width: 150,
            renderCell: (data) => {
                if (data.rowNode.type === "group") {
                    return data.value;
                }
                return <p>{data.formattedValue}</p>;
            },
            valueGetter: (value, row) => {
                return row.customerInfo?.customerOrg;
            },
            groupingValueGetter: (value, row) => {
                return row.customerInfo?.customerOrg ?? 'No organization';
            },
        },

By the way, in the renderCell, I would advise you to use data.formattedValue instead of re-accessing it from the row.

from mui-x.

flaviendelangle avatar flaviendelangle commented on May 28, 2024

By the way, you might not do this in your real application, but getRowId should be memoized, otherwise you will end up with terrible performances.
The doc is here

from mui-x.

michelengelen avatar michelengelen commented on May 28, 2024

@cbrainee if this solution fits your use-case please feel free to close the issue.

from mui-x.

github-actions avatar github-actions commented on May 28, 2024

The issue has been inactive for 7 days and has been automatically closed.

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.