Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DataGrid] Move column resizing to XGrid only #257

Merged
merged 19 commits into from
Sep 11, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { DataGrid } from '@material-ui/data-grid';
import { XGrid } from '@material-ui/x-grid';

const rows = [
{
Expand All @@ -12,7 +12,7 @@ const rows = [
export default function ColumnWidthGrid() {
return (
<div style={{ height: 250, width: '100%' }}>
<DataGrid
<XGrid
columns={[
{ field: 'id', resizable: false },
{ field: 'username' },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { DataGrid } from '@material-ui/data-grid';
import { XGrid } from '@material-ui/x-grid';

const rows = [
{
Expand All @@ -12,7 +12,7 @@ const rows = [
export default function ColumnWidthGrid() {
return (
<div style={{ height: 250, width: '100%' }}>
<DataGrid
<XGrid
columns={[
{ field: 'id', resizable: false },
{ field: 'username' },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import * as React from 'react';
import { DataGrid } from '@material-ui/data-grid';
import { XGrid } from '@material-ui/x-grid';

const rows = [
{
id: 1,
username: 'defunkt',
username: 'material-ui',
age: 38,
},
];

export default function ColumnWidthGrid() {
return (
<div style={{ height: 250, width: '100%' }}>
<DataGrid
<XGrid
columns={[
{ field: 'id' },
{ field: 'username', width: 200 },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { DataGrid } from '@material-ui/data-grid';
import { XGrid } from '@material-ui/x-grid';

const rows = [
{
Expand All @@ -12,7 +12,7 @@ const rows = [
export default function ColumnWidthGrid() {
return (
<div style={{ height: 250, width: '100%' }}>
<DataGrid
<XGrid
dtassone marked this conversation as resolved.
Show resolved Hide resolved
columns={[
{ field: 'id' },
{ field: 'username', width: 200 },
Expand Down
4 changes: 3 additions & 1 deletion docs/src/pages/components/data-grid/columns/columns.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ To change the width of a column, use the `width` property available in `ColDef`.

{{"demo": "pages/components/data-grid/columns/ColumnWidthGrid.js"}}

## Column sizing
## Column sizing ⚡️

By default, all columns can be resized by dragging the right portion of the column.
To prevent the resizing of a column, set `resizable: false` in the `ColDef`.
Expand All @@ -68,6 +68,8 @@ To prevent the resizing of a column, set `resizable: false` in the `ColDef`.
- https://www.jqwidgets.com/react/react-grid/#https://www.jqwidgets.com/react/react-grid/react-grid-columnsresize.htm
-->

Alternatively, to disable all columns resize, set the prop `disableColumnResize` to `true`.
oliviertassinari marked this conversation as resolved.
Show resolved Hide resolved

## Column types

To facilitate configuration of the columns, some column types are predefined.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ export const useStyles = makeStyles(
outline: 'none',
display: 'flex',
flexDirection: 'column',
'& *::-webkit-scrollbar-track': {
borderRadius: 10,
},
'& *::-webkit-scrollbar': {
width: 8,
height: 8,
},
'& *::-webkit-scrollbar-thumb': {
borderRadius: 10,
backgroundColor: borderColor,
},
Copy link
Member

@oliviertassinari oliviertassinari Sep 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong pull request? Isn't this one for #260? Could we keep the pull requests isolated :)?

Copy link
Member

@oliviertassinari oliviertassinari Sep 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, what about we only mess around if the theme is dark? Disturbing the UX as little as necessary. Especially, I don't think that we should change the size of the scrollbar.

'& *, & *::before, & *::after': {
boxSizing: 'inherit',
},
Expand Down
2 changes: 1 addition & 1 deletion packages/grid/x-grid-modules/src/models/gridOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export interface GridOptions {
export const DEFAULT_GRID_OPTIONS: GridOptions = {
rowHeight: 52,
headerHeight: 56,
scrollbarSize: 15,
scrollbarSize: 10,
dtassone marked this conversation as resolved.
Show resolved Hide resolved
columnBuffer: 2,
rowsPerPageOptions: [25, 50, 100],
pageSize: 100,
Expand Down