Giter Site home page Giter Site logo

Comments (3)

michelengelen avatar michelengelen commented on August 16, 2024

Hey @b3ernardo I did just check it on next.js (v14) myself and does work as intended:

Code:

'use client'

import * as React from 'react'

import { DataGrid, GridColDef, GridColumnGroupingModel } from '@mui/x-data-grid'

const columns: GridColDef[] = [
    { field: 'id', headerName: 'ID', width: 90 },
    {
        field: 'firstName',
        headerName: 'First name',
        width: 150
    },
    {
        field: 'lastName',
        headerName: 'Last name',
        width: 150
    },
    {
        field: 'age',
        headerName: 'Age',
        type: 'number',
        width: 110
    }
]

const rows = [
    { age: 14, firstName: 'Jon', id: 1, lastName: 'Snow' },
    { age: 31, firstName: 'Cersei', id: 2, lastName: 'Lannister' },
    { age: 31, firstName: 'Jaime', id: 3, lastName: 'Lannister' },
    { age: 11, firstName: 'Arya', id: 4, lastName: 'Stark' },
    { age: null, firstName: 'Daenerys', id: 5, lastName: 'Targaryen' },
    { age: 150, firstName: null, id: 6, lastName: 'Melisandre' },
    { age: 44, firstName: 'Ferrara', id: 7, lastName: 'Clifford' },
    { age: 36, firstName: 'Rossini', id: 8, lastName: 'Frances' },
    { age: 65, firstName: 'Harvey', id: 9, lastName: 'Roxie' }
]

const columnGroupingModel: GridColumnGroupingModel = [
    {
        children: [{ field: 'id' }],
        description: '',
        groupId: 'Internal'
    },
    {
        children: [
            {
                children: [{ field: 'lastName' }, { field: 'firstName' }],
                groupId: 'Full name'
            },
            { field: 'age' }
        ],
        groupId: 'Basic info'
    }
]

export default function Page() {
    return (
        <div style={{ height: 400, width: '100%' }}>
            <DataGrid
                checkboxSelection
                disableRowSelectionOnClick
                columnGroupingModel={columnGroupingModel}
                columns={columns}
                rows={rows}
            />
        </div>
    )
}
❯ cat package.json
{
  "name": "my-app",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@emotion/react": "^11.11.4",
    "@emotion/styled": "^11.11.5",
    "@mui/material": "^5.15.15",
    "@mui/x-data-grid": "^7.5.1",
    "@mui/x-data-grid-generator": "^7.5.1",
    "@mui/x-data-grid-premium": "^7.5.1",
    "@mui/x-data-grid-pro": "^7.5.1",
    "next": "14.2.3",
    "react": "^18",
    "react-dom": "^18"
  },
  "devDependencies": {
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "eslint": "^8",
    "eslint-config-next": "14.2.3",
    "typescript": "^5"
  }
}

as you can see here it does show the groups just fine:
Screenshot 2024-05-28 at 17 30 20

Could you please double-check your implementation?

from mui-x.

b3ernardo avatar b3ernardo commented on August 16, 2024

Thanks for your comment. I tested it by creating a new Next.js project, and it worked. But going back to my original project, it doesn't work. I updated the libraries, and it still didn't work. I'll need to spend more time figuring out what's going on.

from mui-x.

github-actions avatar github-actions commented on August 16, 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.

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