Skip to content

Update column moving topic for React 19 #1508

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: vnext
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions doc/en/components/grids/_shared/column-moving.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ public headerTemplate = (ctx: IgcCellTemplateContext) => {
```

```tsx
function headerTemplate(ctx: IgrCellTemplateContext) {
const headerTemplate = (ctx: IgrCellTemplateContext) => {
return (
<>
<IgrIcon draggable="false" onClick={onClick}></IgrIcon>
<IgrIcon draggable={false} onClick={onClick}></IgrIcon>
</>
);
}
Expand Down Expand Up @@ -85,7 +85,7 @@ function headerTemplate(ctx: IgrCellTemplateContext) {

<!-- React -->
```tsx
<{ComponentSelector} moving="true"></{ComponentSelector}>
<{ComponentSelector} moving={true}></{ComponentSelector}>
```
<!-- end: React -->

Expand Down Expand Up @@ -120,9 +120,9 @@ function headerTemplate(ctx: IgrCellTemplateContext) {

<!-- React -->
```tsx
<{ComponentSelector} moving="true">
<{ComponentSelector} moving={true}>
...
<{RowIslandSelector} moving="true"></{RowIslandSelector}>
<{RowIslandSelector} moving={true}></{RowIslandSelector}>
</{ComponentSelector}>
```
<!-- end: React -->
Expand Down Expand Up @@ -212,15 +212,15 @@ public onColumnMovingEnd(event) {

<!-- ComponentStart: Grid, HierarchicalGrid -->
```tsx
function onColumnMovingEnd(grid: IgrGridBaseDirective, event: IgrColumnMovingEventArgs) {
const onColumnMovingEnd = (grid: IgrGridBaseDirective, event: IgrColumnMovingEventArgs) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Event signature is wrong here. The grid is no longer passed. Also, update the handler code

if (event.detail.source.field === "Category" && event.detail.target.field === "Change On Year(%)") {
event.detail.cancel = true;
}
}

<{ComponentSelector} autoGenerate="false" moving="true" data={data} columnMovingEnd={onColumnMovingEnd}>
<{ComponentSelector} autoGenerate={false} moving={true} data={data} onColumnMovingEnd={onColumnMovingEnd}>
<IgrColumn field="Category"></IgrColumn>
<IgrColumn field="Change On Year(%)" dataType="Number" ></IgrColumn>
<IgrColumn field="Change On Year(%)" dataType="Number"></IgrColumn>
</{ComponentSelector}>
```
<!-- ComponentEnd: Grid, HierarchicalGrid -->
Expand Down