Skip to content

Commit 6a585a8

Browse files
committed
chore: update grid props
1 parent b7f92b0 commit 6a585a8

File tree

3 files changed

+21
-18
lines changed

3 files changed

+21
-18
lines changed

examples/kendo-react-build-a-sales-dashboard/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"@progress/kendo-data-query": "^1.7.0",
6+
"@progress/kendo-data-query": "^1.7.1",
77
"@progress/kendo-date-math": "^1.5.14",
8-
"@progress/kendo-drawing": "^1.21.1",
8+
"@progress/kendo-drawing": "^1.21.2",
99
"@progress/kendo-file-saver": "^1.1.2",
1010
"@progress/kendo-inputs-common": "^3.1.1",
1111
"@progress/kendo-intl": "^3.1.2",
12-
"@progress/kendo-licensing": "^1.3.3",
12+
"@progress/kendo-licensing": "^1.6.0",
1313
"@progress/kendo-popup-common": "^1.9.2",
1414
"@progress/kendo-react-animation": "^11.0.0",
1515
"@progress/kendo-react-buttons": "^11.0.0",

examples/kendo-react-build-a-sales-dashboard/src/components/GridContainer.js

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ import React from 'react';
22
import { Grid, GridColumn as Column } from '@progress/kendo-react-grid';
33
import { gridData } from '../data/appData';
44
import { Sparkline } from '@progress/kendo-react-charts';
5+
import { Checkbox } from '@progress/kendo-react-inputs';
6+
7+
const SparkLineChartCell = (props) => <td><Sparkline data={props.dataItem.PriceHistory} /></td>
8+
const ActiveCell = (props) => <td><Checkbox disabled defaultChecked={props.dataItem[props.field]} /></td>
59

6-
const SparkLineChartCell = (props) => <td><Sparkline data={props.dataItem.PriceHistory}/></td>
710
const processData = (data) => {
811
data.forEach((item) => {
912
item.PriceHistory = Array.from({ length: 20 }, () => Math.floor(Math.random() * 100));
@@ -15,20 +18,21 @@ const processData = (data) => {
1518
export const GridContainer = () => (
1619

1720
<div>
18-
<Grid style={{ height: '300px' }} data={processData(gridData)}>
19-
<Column field="ProductID" title="ID" width="40px" />
20-
<Column field="ProductName" title="Name" width="160px" />
21-
<Column field="Category.CategoryName" title="Category Name" width="80px" />
21+
<Grid
22+
style={{ height: '300px' }}
23+
data={processData(gridData)}
24+
defaultSort={[{
25+
field: "UnitPrice",
26+
dir:"asc"
27+
}]}
28+
sortable
29+
>
30+
<Column field="ProductID" title="ID" width="40px" sortable={false} />
31+
<Column field="ProductName" title="Name" />
2232
<Column field="UnitPrice" title="Price" width="80px" />
23-
<Column field="UnitsInStock" title="Stock" width="90px" />
24-
<Column field="PriceHistory" width="130px" cell={SparkLineChartCell} title="Price history" />
25-
<Column field="Discontinued" width="130px"
26-
cell={(props) => (
27-
<td>
28-
<input className="k-checkbox" type="checkbox" disabled defaultChecked={props.dataItem[props.field]} />
29-
<label className="k-checkbox-label"></label>
30-
</td>
31-
)} />
33+
<Column field="UnitsInStock" title="In stock" width="100px" sortable={false} />
34+
<Column field="PriceHistory"title="Price history" width="200px" cells={{ data: SparkLineChartCell }} sortable={false} />
35+
<Column field="Discontinued" title="Active" width="70px" cells={{ data: ActiveCell }} sortable={false} />
3236
</Grid>
3337
</div>
3438
);

examples/kendo-react-sales-dashboard/src/components/GridContainer.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ class SparkLineChartCell extends React.Component {
1313

1414
class ActiveCell extends React.Component {
1515
render() {
16-
console.log(this.props.dataItem);
1716
return (
1817
<td><Checkbox disabled defaultChecked={this.props.dataItem[this.props.field]} /></td>
1918
)

0 commit comments

Comments
 (0)