Skip to content

Commit 606dd61

Browse files
committed
updated hgrid sample to v19
1 parent b734ed2 commit 606dd61

1 file changed

Lines changed: 11 additions & 16 deletions

File tree

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

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

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, { useEffect, useRef, useState } from "react";
22
import ReactDOM from "react-dom/client";
33
import "./index.css";
44

5-
import { GridPagingMode, IgrGridCreatedEventArgs, IgrHierarchicalGridModule, IgrPaginator } from "igniteui-react-grids";
5+
import { IgrGridCreatedEventArgs, IgrPaginator } from "igniteui-react-grids";
66
import { IgrHierarchicalGrid, IgrColumn, IgrRowIsland } from "igniteui-react-grids";
77

88
import "igniteui-react-grids/grids/combined";
@@ -11,8 +11,6 @@ import { RemoteService } from "./RemoteService";
1111
import { IgrNumberEventArgs } from "igniteui-react";
1212
import { CustomersWithPageResponseModel } from "./CustomersWithPageResponseModel";
1313

14-
IgrHierarchicalGridModule.register();
15-
1614
export default function App() {
1715
const hierarchicalGrid = useRef<IgrHierarchicalGrid>(null);
1816
const paginator = useRef<IgrPaginator>(null);
@@ -48,15 +46,14 @@ export default function App() {
4846
}
4947

5048
function gridCreated(
51-
rowIsland: IgrRowIsland,
5249
event: IgrGridCreatedEventArgs,
5350
parentKey: string
5451
) {
5552
const context = event.detail;
5653
context.grid.isLoading = true;
5754

5855
const parentId: string = context.parentID;
59-
const childDataKey: string = rowIsland.childDataKey;
56+
const childDataKey: string = context.owner.childDataKey;
6057

6158
RemoteService.getHierarchyDataById(parentKey, parentId, childDataKey)
6259
.then((data: any) => {
@@ -73,11 +70,11 @@ export default function App() {
7370

7471
}
7572

76-
function onPageNumberChange(paginator: IgrPaginator, args: IgrNumberEventArgs) {
73+
function onPageNumberChange(args: IgrNumberEventArgs) {
7774
setPage(args.detail);
7875
}
7976

80-
function onPageSizeChange(paginator: IgrPaginator, args: IgrNumberEventArgs) {
77+
function onPageSizeChange(args: IgrNumberEventArgs) {
8178
setPerPage(args.detail);
8279
}
8380

@@ -88,15 +85,15 @@ export default function App() {
8885
<IgrHierarchicalGrid
8986
ref={hierarchicalGrid}
9087
data={data}
91-
pagingMode={GridPagingMode.Remote}
88+
pagingMode={"remote"}
9289
primaryKey="customerId"
9390
height="600px"
9491
>
9592
<IgrPaginator
9693
perPage={perPage}
9794
ref={paginator}
98-
pageChange={onPageNumberChange}
99-
perPageChange={onPageSizeChange}>
95+
onPageChange={onPageNumberChange}
96+
onPerPageChange={onPageSizeChange}>
10097
</IgrPaginator>
10198
<IgrColumn field="customerId" hidden={true}></IgrColumn>
10299
<IgrColumn field="companyName" header="Company Name"></IgrColumn>
@@ -108,10 +105,9 @@ export default function App() {
108105
<IgrRowIsland
109106
childDataKey="Orders"
110107
primaryKey="orderId"
111-
gridCreated={(
112-
rowIsland: IgrRowIsland,
108+
onGridCreated={(
113109
e: IgrGridCreatedEventArgs
114-
) => gridCreated(rowIsland, e, "Customers")}
110+
) => gridCreated(e, "Customers")}
115111
>
116112
<IgrColumn field="orderId" hidden={true}></IgrColumn>
117113
<IgrColumn field="shipAddress.country" header="Ship Country"></IgrColumn>
@@ -122,10 +118,9 @@ export default function App() {
122118
<IgrRowIsland
123119
childDataKey="Details"
124120
primaryKey="productId"
125-
gridCreated={(
126-
rowIsland: IgrRowIsland,
121+
onGridCreated={(
127122
e: IgrGridCreatedEventArgs
128-
) => gridCreated(rowIsland, e, "Orders")}
123+
) => gridCreated(e, "Orders")}
129124
>
130125
<IgrColumn field="productId" hidden={true}></IgrColumn>
131126
<IgrColumn field="quantity" header="Quantity"></IgrColumn>

0 commit comments

Comments
 (0)