Skip to content

Commit 4c9c515

Browse files
committed
chore: update grid props in homepage demo app
1 parent 978ef14 commit 4c9c515

File tree

3 files changed

+27
-41
lines changed

3 files changed

+27
-41
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from 'react';
2+
3+
export const Author = (props) => {
4+
return (
5+
<td>
6+
<p className="author-container">
7+
<span>
8+
<img
9+
className="img-circle"
10+
alt="User Avatar"
11+
src={props.dataItem.node.author.avatarUrl} style={{ width: 30, height: 30 }}
12+
/>
13+
</span>
14+
{props.dataItem.node.author.login}
15+
</p>
16+
</td>
17+
)
18+
}

examples/kendo-react-homepage-demo/src/components/KendoGridContainer.jsx

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,20 @@
11
import React from "react";
22
import { Query } from '@apollo/client/react/components';
33
import { Grid, GridColumn } from '@progress/kendo-react-grid';
4-
import { process } from '@progress/kendo-data-query';
54
import { ColumnMenu } from './ColumnMenu';
65
import { DetailComponent } from './DetailComponent';
76
import { StateCell } from './StateCell';
8-
import { АssignedTo } from './АssignedTo';
7+
import { Author } from './Author';
98
import { LoadingPanel } from './LoadingPanel';
109

1110
import { getQuery } from '../queries/github';
1211
import kendoReactIssues from '../data/fallBackData.json';
1312
import reactIssues from '../data/fallBackDataReact.json';
1413

15-
16-
1714
export class KendoGridContainer extends React.Component {
18-
state = {
19-
skip: 0,
20-
take: 10
21-
}
2215
allLabels = [];
2316
uniqueLabels = [];
2417
initialLoad = true;
25-
expandChange = (event) => {
26-
event.dataItem.expanded = !event.dataItem.expanded;
27-
this.forceUpdate();
28-
}
2918

3019
getOccurrence = (array, value) => {
3120
var count = 0;
@@ -106,20 +95,20 @@ export class KendoGridContainer extends React.Component {
10695
return (
10796
<React.Fragment>
10897
<Grid
109-
data={process(gridData, this.state)}
98+
data={gridData}
99+
autoProcessData={true}
100+
dataItemKey="node.number"
101+
detail={(props) => <DetailComponent {...props} makeChartData={this.makeChartData} />}
110102
sortable
111103
pageable
112-
{...this.state}
113-
onDataStateChange={(e) => { this.setState(e.dataState); }}
114-
expandField="expanded"
115-
onExpandChange={this.expandChange}
104+
defaultSkip={0}
105+
defaultTake={20}
116106
style={{ height: '100%', overflow: 'auto', borderInline: 0 }}
117-
detail={(props) => <DetailComponent {...props} makeChartData={this.makeChartData} />}
118107
>
119108
<GridColumn field="node.number" title="ID" width={100} />
120-
<GridColumn field="node.state" title="State" cell={StateCell} width={100} />
109+
<GridColumn field="node.state" title="State" cells={{ data: StateCell } } width={100} />
121110
<GridColumn field="node.title" title="Issue" columnMenu={ColumnMenu} />
122-
<GridColumn field="node.assignees.node" title="Assigned to" width={200} cell={АssignedTo} sortable={false} />
111+
<GridColumn field="node.author.login" title="Author" width={200} cells={{ data: Author }} sortable={false} />
123112
<GridColumn field="node.createdAt" title="Created on" width={200} format='{0:yyyy/MM/dd hh:mm a}' filter="date" columnMenu={ColumnMenu} />
124113
</Grid>
125114
{loading && <LoadingPanel />}

examples/kendo-react-homepage-demo/src/components/АssignedTo.jsx

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)