Skip to content

Commit 4cf2f7b

Browse files
committed
formatted hgrid sample
1 parent 606dd61 commit 4cf2f7b

1 file changed

Lines changed: 31 additions & 24 deletions

File tree

  • samples/grids/hierarchical-grid/remote-paging-hgrid/src

samples/grids/hierarchical-grid/remote-paging-hgrid/src/index.tsx

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ import ReactDOM from "react-dom/client";
33
import "./index.css";
44

55
import { IgrGridCreatedEventArgs, IgrPaginator } from "igniteui-react-grids";
6-
import { IgrHierarchicalGrid, IgrColumn, IgrRowIsland } from "igniteui-react-grids";
6+
import {
7+
IgrHierarchicalGrid,
8+
IgrColumn,
9+
IgrRowIsland,
10+
} from "igniteui-react-grids";
711

812
import "igniteui-react-grids/grids/combined";
913
import "igniteui-react-grids/grids/themes/light/bootstrap.css";
@@ -41,17 +45,13 @@ export default function App() {
4145
setData([]);
4246
// Stop loading even if error occurs. Prevents endless loading
4347
hierarchicalGrid.current.isLoading = false;
44-
45-
})
48+
});
4649
}
4750

48-
function gridCreated(
49-
event: IgrGridCreatedEventArgs,
50-
parentKey: string
51-
) {
51+
function gridCreated(event: IgrGridCreatedEventArgs, parentKey: string) {
5252
const context = event.detail;
5353
context.grid.isLoading = true;
54-
54+
5555
const parentId: string = context.parentID;
5656
const childDataKey: string = context.owner.childDataKey;
5757

@@ -66,8 +66,7 @@ export default function App() {
6666
context.grid.data = [];
6767
context.grid.isLoading = false;
6868
context.grid.markForCheck();
69-
})
70-
69+
});
7170
}
7271

7372
function onPageNumberChange(args: IgrNumberEventArgs) {
@@ -81,20 +80,19 @@ export default function App() {
8180
return (
8281
<div className="container sample ig-typography">
8382
<div className="container fill">
84-
8583
<IgrHierarchicalGrid
8684
ref={hierarchicalGrid}
8785
data={data}
8886
pagingMode={"remote"}
8987
primaryKey="customerId"
9088
height="600px"
9189
>
92-
<IgrPaginator
90+
<IgrPaginator
9391
perPage={perPage}
9492
ref={paginator}
9593
onPageChange={onPageNumberChange}
96-
onPerPageChange={onPageSizeChange}>
97-
</IgrPaginator>
94+
onPerPageChange={onPageSizeChange}
95+
></IgrPaginator>
9896
<IgrColumn field="customerId" hidden={true}></IgrColumn>
9997
<IgrColumn field="companyName" header="Company Name"></IgrColumn>
10098
<IgrColumn field="contactName" header="Contact Name"></IgrColumn>
@@ -105,22 +103,32 @@ export default function App() {
105103
<IgrRowIsland
106104
childDataKey="Orders"
107105
primaryKey="orderId"
108-
onGridCreated={(
109-
e: IgrGridCreatedEventArgs
110-
) => gridCreated(e, "Customers")}
106+
onGridCreated={(e: IgrGridCreatedEventArgs) =>
107+
gridCreated(e, "Customers")
108+
}
111109
>
112110
<IgrColumn field="orderId" hidden={true}></IgrColumn>
113-
<IgrColumn field="shipAddress.country" header="Ship Country"></IgrColumn>
111+
<IgrColumn
112+
field="shipAddress.country"
113+
header="Ship Country"
114+
></IgrColumn>
114115
<IgrColumn field="shipAddress.city" header="Ship City"></IgrColumn>
115-
<IgrColumn field="shipAddress.street" header="Ship Address"></IgrColumn>
116-
<IgrColumn field="orderDate" header="Order Date" dataType="date"></IgrColumn>
116+
<IgrColumn
117+
field="shipAddress.street"
118+
header="Ship Address"
119+
></IgrColumn>
120+
<IgrColumn
121+
field="orderDate"
122+
header="Order Date"
123+
dataType="date"
124+
></IgrColumn>
117125

118126
<IgrRowIsland
119127
childDataKey="Details"
120128
primaryKey="productId"
121-
onGridCreated={(
122-
e: IgrGridCreatedEventArgs
123-
) => gridCreated(e, "Orders")}
129+
onGridCreated={(e: IgrGridCreatedEventArgs) =>
130+
gridCreated(e, "Orders")
131+
}
124132
>
125133
<IgrColumn field="productId" hidden={true}></IgrColumn>
126134
<IgrColumn field="quantity" header="Quantity"></IgrColumn>
@@ -129,7 +137,6 @@ export default function App() {
129137
</IgrRowIsland>
130138
</IgrRowIsland>
131139
</IgrHierarchicalGrid>
132-
133140
</div>
134141
</div>
135142
);

0 commit comments

Comments
 (0)