Skip to content

Commit

Permalink
[docs] Remove id columns (mui#355)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari authored and dtassone committed Nov 9, 2020
1 parent b93c27c commit 592703a
Show file tree
Hide file tree
Showing 26 changed files with 3 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export default function ColumnTypesDemo() {
<div style={{ height: 300, width: '100%' }}>
<DataGrid
columns={[
{ field: 'id', hide: true },
{ field: 'name', type: 'string' },
{ field: 'age', type: 'number' },
{ field: 'dateCreated', type: 'date', width: 130 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export default function ColumnTypesDemo() {
<div style={{ height: 300, width: '100%' }}>
<DataGrid
columns={[
{ field: 'id', hide: true },
{ field: 'name', type: 'string' },
{ field: 'age', type: 'number' },
{ field: 'dateCreated', type: 'date', width: 130 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export default function CustomColumnTypesGrid() {
<div style={{ height: 300, width: '100%' }} className={classes.root}>
<DataGrid
columns={[
{ field: 'id', hide: true },
{ field: 'status', width: 130 },
{ field: 'subTotal', ...usdPrice },
{ field: 'total', ...usdPrice },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export default function CustomColumnTypesGrid() {
<div style={{ height: 300, width: '100%' }} className={classes.root}>
<DataGrid
columns={[
{ field: 'id', hide: true },
{ field: 'status', width: 130 },
{ field: 'subTotal', ...usdPrice },
{ field: 'total', ...usdPrice },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ They are mapped to rows through their `field` property.

```tsx
const columns: ColDef[] = [
{ field: 'id', hide: true },
{ field: 'col1', headerName: 'Column 1', width: 150 },
{ field: 'col2', headerName: 'Column 2', width: 150 },
];
Expand All @@ -83,7 +82,6 @@ const rows: RowsProp = [
];

const columns: ColDef[] = [
{ field: 'id', hide: true },
{ field: 'col1', headerName: 'Column 1', width: 150 },
{ field: 'col2', headerName: 'Column 2', width: 150 },
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as React from 'react';
import { DataGrid } from '@material-ui/data-grid';

const columns = [
{ field: 'id', hide: true },
{
field: 'date',
headerName: 'Year',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as React from 'react';
import { DataGrid, ColDef, ValueFormatterParams } from '@material-ui/data-grid';

const columns: ColDef[] = [
{ field: 'id', hide: true },
{
field: 'date',
headerName: 'Year',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as React from 'react';
import { DataGrid } from '@material-ui/data-grid';

const columns = [
{ field: 'id', hide: true },
{
field: 'date',
width: 150,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as React from 'react';
import { DataGrid, ColDef } from '@material-ui/data-grid';

const columns: ColDef[] = [
{ field: 'id', hide: true },
{
field: 'date',
width: 150,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { DataGrid } from '@material-ui/data-grid';
import { makeStyles } from '@material-ui/core/styles';

const columns = [
{ field: 'id', hide: true },
{
field: 'name',
cellClassName: 'super-app-theme--cell',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Columns, DataGrid, CellClassParams } from '@material-ui/data-grid';
import { makeStyles } from '@material-ui/core/styles';

const columns: Columns = [
{ field: 'id', hide: true },
{
field: 'name',
cellClassName: 'super-app-theme--cell',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { DataGrid } from '@material-ui/data-grid';
import { makeStyles } from '@material-ui/core/styles';

const columns = [
{ field: 'id', hide: true },
{
field: 'first',
headerClassName: 'super-app-theme--header',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Columns, DataGrid } from '@material-ui/data-grid';
import { makeStyles } from '@material-ui/core/styles';

const columns: Columns = [
{ field: 'id', hide: true },
{
field: 'first',
headerClassName: 'super-app-theme--header',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as React from 'react';
import { DataGrid } from '@material-ui/data-grid';

const columns = [
{ field: 'id', hide: true },
{
field: 'date',
headerName: 'Year',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as React from 'react';
import { DataGrid, ColDef, ValueFormatterParams } from '@material-ui/data-grid';

const columns: ColDef[] = [
{ field: 'id', hide: true },
{
field: 'date',
headerName: 'Year',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ function getFullName(params) {
}

const columns = [
{ field: 'id', hide: true },
{ field: 'firstName', headerName: 'First name', width: 130 },
{ field: 'lastName', headerName: 'Last name', width: 130 },
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ function getFullName(params: ValueGetterParams) {
}

const columns: ColDef[] = [
{ field: 'id', hide: true },
{ field: 'firstName', headerName: 'First name', width: 130 },
{ field: 'lastName', headerName: 'Last name', width: 130 },
{
Expand Down
6 changes: 0 additions & 6 deletions docs/src/pages/components/data-grid/rendering/rendering.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ function getFullName(params: ValueGetterParams) {
}

const columns: ColDef[] = [
{ field: 'id', hide: true },
{ field: 'firstName', headerName: 'First name', width: 130 },
{ field: 'lastName', headerName: 'Last name', width: 130 },
{
Expand All @@ -52,7 +51,6 @@ For instance, you might want to format a JavaScript date object into a string ye

```tsx
const columns: ColDef[] = [
{ field: 'id', hide: true },
{
field: 'date',
headerName: 'Year',
Expand Down Expand Up @@ -81,7 +79,6 @@ However, it trades to be able to only render in a cell in exchange for allowing

```tsx
const columns: ColDef[] = [
{ field: 'id', hide: true },
{
field: 'date',
headerName: 'Year',
Expand All @@ -106,7 +103,6 @@ It takes precedence over the `headerName` property.

```tsx
const columns: ColDef[] = [
{ field: 'id', hide: true },
{
field: 'date',
width: 150,
Expand Down Expand Up @@ -134,7 +130,6 @@ The `ColDef` type has properties to apply class names and custom CSS on the head

```tsx
const columns: Columns = [
{ field: 'id', hide: true },
{
field: 'first',
headerClassName: 'super-app-theme--header',
Expand All @@ -159,7 +154,6 @@ The `ColDef` type has properties to apply class names and custom CSS on the cell

```tsx
const columns: Columns = [
{ field: 'id', hide: true },
{
field: 'name',
cellClassName: 'super-app-theme--cell',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
} from '@material-ui/x-grid-data-generator';

const columns = [
{ field: 'id', hide: true },
{ field: 'name' },
{ field: 'age', type: 'number' },
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
} from '@material-ui/x-grid-data-generator';

const columns: Columns = [
{ field: 'id', hide: true },
{ field: 'name' },
{ field: 'age', type: 'number' },
{
Expand Down
5 changes: 1 addition & 4 deletions packages/grid/data-grid/src/DataGrid.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ describe('<DataGrid />', () => {
brand: 'Nike',
},
],
columns: [
{ field: 'id', hide: true },
{ field: 'brand', width: 100 },
],
columns: [{ field: 'brand', width: 100 }],
};
describe('layout', () => {
before(function beforeHook() {
Expand Down
10 changes: 2 additions & 8 deletions packages/grid/x-grid/src/XGrid.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ describe('<XGrid />', () => {
brand: 'Puma',
},
],
columns: [
{ field: 'id', hide: true },
{ field: 'brand', width: 100 },
],
columns: [{ field: 'brand', width: 100 }],
};

before(function beforeHook() {
Expand Down Expand Up @@ -194,10 +191,7 @@ describe('<XGrid />', () => {
brand: 'Nike',
},
]}
columns={[
{ field: 'id', hide: true },
{ field: 'brand', width: 100 },
]}
columns={[{ field: 'brand', width: 100 }]}
checkboxSelection
/>
</div>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ function CustomErrorOverlay(props) {

export default function CustomErrorDemo() {
const columns: Columns = [
{ field: 'id', hide: true },
{ field: 'name', type: 'string' },
{
field: 'age',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { randomCreatedDate, randomUpdatedDate } from '@material-ui/x-grid-data-g

export default function ExceptionDemo() {
const columns: Columns = [
{ field: 'id', hide: true },
{ field: 'name', type: 'string' },
{
field: 'age',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as React from 'react';
import { Columns, useApiRef, XGrid } from '@material-ui/x-grid';

const columns: Columns = [
{ field: 'id', hide: true },
{ field: 'name', type: 'string' },
{ field: 'email', type: 'string' },
{ field: 'age', type: 'number' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as React from 'react';
import { Columns, XGrid } from '@material-ui/x-grid';

const columns: Columns = [
{ field: 'id', hide: true },
{ field: 'name', type: 'string' },
{ field: 'email', type: 'string' },
{ field: 'age', type: 'number' },
Expand Down

0 comments on commit 592703a

Please sign in to comment.