Skip to content

Commit

Permalink
[DataGridPro] Implement Row pinning (#4863)
Browse files Browse the repository at this point in the history
  • Loading branch information
cherniavskii committed Jul 27, 2022
1 parent 4dabd10 commit e273835
Show file tree
Hide file tree
Showing 99 changed files with 2,798 additions and 554 deletions.
32 changes: 16 additions & 16 deletions docs/data/data-grid/aggregation/AggregationColDefAggregable.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,22 @@ export default function AggregationColDefAggregable() {
const data = useMovieData();

return (
<DataGridPremium
// The 2 following props are here to avoid scroll in the demo while we don't have pinned rows
rows={data.rows.slice(0, 3)}
autoHeight
columns={COLUMNS}
initialState={{
private_aggregation: {
model: {
gross: 'sum',
year: 'sum',
<div style={{ height: 400, width: '100%' }}>
<DataGridPremium
rows={data.rows}
columns={COLUMNS}
initialState={{
private_aggregation: {
model: {
gross: 'sum',
year: 'sum',
},
},
},
}}
experimentalFeatures={{
private_aggregation: true,
}}
/>
}}
experimentalFeatures={{
private_aggregation: true,
}}
/>
</div>
);
}
32 changes: 16 additions & 16 deletions docs/data/data-grid/aggregation/AggregationColDefAggregable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,22 @@ export default function AggregationColDefAggregable() {
const data = useMovieData();

return (
<DataGridPremium
// The 2 following props are here to avoid scroll in the demo while we don't have pinned rows
rows={data.rows.slice(0, 3)}
autoHeight
columns={COLUMNS}
initialState={{
private_aggregation: {
model: {
gross: 'sum',
year: 'sum',
<div style={{ height: 400, width: '100%' }}>
<DataGridPremium
rows={data.rows}
columns={COLUMNS}
initialState={{
private_aggregation: {
model: {
gross: 'sum',
year: 'sum',
},
},
},
}}
experimentalFeatures={{
private_aggregation: true,
}}
/>
}}
experimentalFeatures={{
private_aggregation: true,
}}
/>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<DataGridPremium
rows={data.rows}
columns={COLUMNS}
initialState={{
private_aggregation: {
model: {
gross: 'sum',
year: 'sum',
},
},
}}
experimentalFeatures={{
private_aggregation: true,
}}
/>
24 changes: 13 additions & 11 deletions docs/data/data-grid/aggregation/AggregationControlled.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,18 @@ export default function AggregationControlled() {
});

return (
<DataGridPremium
// The 2 following props are here to avoid scroll in the demo while we don't have pinned rows
rows={data.rows.slice(0, 3)}
autoHeight
columns={COLUMNS}
private_aggregationModel={aggregationModel}
private_onAggregationModelChange={(newModel) => setAggregationModel(newModel)}
experimentalFeatures={{
private_aggregation: true,
}}
/>
<div style={{ height: 400, width: '100%' }}>
<DataGridPremium
rows={data.rows}
columns={COLUMNS}
private_aggregationModel={aggregationModel}
private_onAggregationModelChange={(newModel) =>
setAggregationModel(newModel)
}
experimentalFeatures={{
private_aggregation: true,
}}
/>
</div>
);
}
24 changes: 13 additions & 11 deletions docs/data/data-grid/aggregation/AggregationControlled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,18 @@ export default function AggregationControlled() {
});

return (
<DataGridPremium
// The 2 following props are here to avoid scroll in the demo while we don't have pinned rows
rows={data.rows.slice(0, 3)}
autoHeight
columns={COLUMNS}
private_aggregationModel={aggregationModel}
private_onAggregationModelChange={(newModel) => setAggregationModel(newModel)}
experimentalFeatures={{
private_aggregation: true,
}}
/>
<div style={{ height: 400, width: '100%' }}>
<DataGridPremium
rows={data.rows}
columns={COLUMNS}
private_aggregationModel={aggregationModel}
private_onAggregationModelChange={(newModel) =>
setAggregationModel(newModel)
}
experimentalFeatures={{
private_aggregation: true,
}}
/>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<DataGridPremium
// The 2 following props are here to avoid scroll in the demo while we don't have pinned rows
rows={data.rows.slice(0, 3)}
autoHeight
rows={data.rows}
columns={COLUMNS}
private_aggregationModel={aggregationModel}
private_onAggregationModelChange={(newModel) => setAggregationModel(newModel)}
private_onAggregationModelChange={(newModel) =>
setAggregationModel(newModel)
}
experimentalFeatures={{
private_aggregation: true,
}}
Expand Down
40 changes: 20 additions & 20 deletions docs/data/data-grid/aggregation/AggregationCustomFunction.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,26 +72,26 @@ export default function AggregationCustomFunction() {
const data = useMovieData();

return (
<DataGridPremium
// The 2 following props are here to avoid scroll in the demo while we don't have pinned rows
rows={data.rows.slice(0, 3)}
autoHeight
columns={COLUMNS}
private_aggregationFunctions={{
...PRIVATE_GRID_AGGREGATION_FUNCTIONS,
firstAlphabetical: firstAlphabeticalAggregation,
lastAlphabetical: lastAlphabeticalAggregation,
}}
initialState={{
private_aggregation: {
model: {
director: 'firstAlphabetical',
<div style={{ height: 400, width: '100%' }}>
<DataGridPremium
rows={data.rows}
columns={COLUMNS}
private_aggregationFunctions={{
...PRIVATE_GRID_AGGREGATION_FUNCTIONS,
firstAlphabetical: firstAlphabeticalAggregation,
lastAlphabetical: lastAlphabeticalAggregation,
}}
initialState={{
private_aggregation: {
model: {
director: 'firstAlphabetical',
},
},
},
}}
experimentalFeatures={{
private_aggregation: true,
}}
/>
}}
experimentalFeatures={{
private_aggregation: true,
}}
/>
</div>
);
}
40 changes: 20 additions & 20 deletions docs/data/data-grid/aggregation/AggregationCustomFunction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,26 +75,26 @@ export default function AggregationCustomFunction() {
const data = useMovieData();

return (
<DataGridPremium
// The 2 following props are here to avoid scroll in the demo while we don't have pinned rows
rows={data.rows.slice(0, 3)}
autoHeight
columns={COLUMNS}
private_aggregationFunctions={{
...PRIVATE_GRID_AGGREGATION_FUNCTIONS,
firstAlphabetical: firstAlphabeticalAggregation,
lastAlphabetical: lastAlphabeticalAggregation,
}}
initialState={{
private_aggregation: {
model: {
director: 'firstAlphabetical',
<div style={{ height: 400, width: '100%' }}>
<DataGridPremium
rows={data.rows}
columns={COLUMNS}
private_aggregationFunctions={{
...PRIVATE_GRID_AGGREGATION_FUNCTIONS,
firstAlphabetical: firstAlphabeticalAggregation,
lastAlphabetical: lastAlphabeticalAggregation,
}}
initialState={{
private_aggregation: {
model: {
director: 'firstAlphabetical',
},
},
},
}}
experimentalFeatures={{
private_aggregation: true,
}}
/>
}}
experimentalFeatures={{
private_aggregation: true,
}}
/>
</div>
);
}
44 changes: 22 additions & 22 deletions docs/data/data-grid/aggregation/AggregationFiltering.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,29 @@ export default function AggregationFiltering() {
const data = useMovieData();

return (
<DataGridPremium
// The 2 following props are here to avoid scroll in the demo while we don't have pinned rows
rows={data.rows.slice(0, 3)}
autoHeight
columns={COLUMNS}
initialState={{
private_aggregation: {
model: {
gross: 'max',
<div style={{ height: 400, width: '100%' }}>
<DataGridPremium
rows={data.rows}
columns={COLUMNS}
initialState={{
private_aggregation: {
model: {
gross: 'max',
},
},
},
filter: {
filterModel: {
items: [
{ columnField: 'title', operatorValue: 'equals', value: 'Titanic' },
],
filter: {
filterModel: {
items: [
{ columnField: 'title', operatorValue: 'equals', value: 'Titanic' },
],
},
},
},
}}
private_aggregationRowsScope="all"
experimentalFeatures={{
private_aggregation: true,
}}
/>
}}
private_aggregationRowsScope="all"
experimentalFeatures={{
private_aggregation: true,
}}
/>
</div>
);
}
44 changes: 22 additions & 22 deletions docs/data/data-grid/aggregation/AggregationFiltering.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,29 @@ export default function AggregationFiltering() {
const data = useMovieData();

return (
<DataGridPremium
// The 2 following props are here to avoid scroll in the demo while we don't have pinned rows
rows={data.rows.slice(0, 3)}
autoHeight
columns={COLUMNS}
initialState={{
private_aggregation: {
model: {
gross: 'max',
<div style={{ height: 400, width: '100%' }}>
<DataGridPremium
rows={data.rows}
columns={COLUMNS}
initialState={{
private_aggregation: {
model: {
gross: 'max',
},
},
},
filter: {
filterModel: {
items: [
{ columnField: 'title', operatorValue: 'equals', value: 'Titanic' },
],
filter: {
filterModel: {
items: [
{ columnField: 'title', operatorValue: 'equals', value: 'Titanic' },
],
},
},
},
}}
private_aggregationRowsScope="all"
experimentalFeatures={{
private_aggregation: true,
}}
/>
}}
private_aggregationRowsScope="all"
experimentalFeatures={{
private_aggregation: true,
}}
/>
</div>
);
}
Loading

0 comments on commit e273835

Please sign in to comment.