Comments (3)
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:
Could you please double-check your implementation?
from mui-x.
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.
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)
- [charts] Axis not plot if the domain contains only one value HOT 3
- [data grid] `onColumnVisibilityModelChange` event returns empty object on show all columns from columns option in toolbar HOT 2
- [data grid] When select filter or manage column from the column menu the popover should open under their respective button HOT 2
- [data grid] how to use `DateRangePicker` as `DataGrid` header filter properly HOT 5
- [pickers] DesktopDateTimePicker not responsive on mobile devices HOT 5
- [data grid] `onRowSelectionModelChange` firing twice HOT 2
- [DataGrid] Demo containers HOT 1
- [data grid] Add row while filter is active HOT 1
- [DataGrid] Reordered row stays highlighted
- [data grid] Updating Columns and Column Grouping Simultaneously and Repeatedly throws Runtime Errors HOT 1
- [charts] Add a line band plotting HOT 4
- [charts] MaxValue to take full width in Horizontal Bar Charts. HOT 2
- [pickers] Change the time placeholder to be `--:-- --` instead of `hh:mm aa` HOT 3
- [data grid] Vertical sticky for column headers in a Data Grid with horizontal scroll HOT 3
- [data grid] Using `initialState` with `sort`, will trigger a `onFetchRows` function call on first load HOT 3
- [fields] Provide DatePicker option to show the label at the top and the placeholder in the field, while empty and unfocused HOT 2
- Babel Configuration Issue: Optional Chaining Syntax Not Supported in MUI X Charts HOT 1
- [data grid] Numbers separator (comma or dot) based on localeText prop HOT 1
- [x-license] setting license key in micro frontend HOT 7
- [data grid] Any opened group by rows is automatically closed before printing HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mui-x.