-
Notifications
You must be signed in to change notification settings - Fork 674
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(abc:st): fix can't
addRow
in group columns (#1871)
- Loading branch information
Showing
4 changed files
with
29 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,16 +14,21 @@ title: | |
Group table head with `columns[n].children`. | ||
|
||
```ts | ||
import { Component } from '@angular/core'; | ||
import { Component, viewChild } from '@angular/core'; | ||
|
||
import { STColumn, STModule } from '@delon/abc/st'; | ||
import { STColumn, STComponent, STModule } from '@delon/abc/st'; | ||
import { NzButtonComponent } from 'ng-zorro-antd/button'; | ||
|
||
@Component({ | ||
selector: 'app-demo', | ||
template: ` <st #st [data]="url" [req]="{ params: params }" [columns]="columns" bordered size="middle" />`, | ||
imports: [STModule] | ||
template: ` | ||
<button nz-button nzType="primary" (click)="addRow()">addRow</button> | ||
<st #st [data]="url" [req]="{ params: params }" [columns]="columns" bordered size="middle" /> | ||
`, | ||
imports: [STModule, NzButtonComponent] | ||
}) | ||
export class DemoComponent { | ||
private readonly st = viewChild<STComponent>('st'); | ||
url = `/users?total=2&field=list`; | ||
params = { a: 1, b: 2 }; | ||
columns: STColumn[] = [ | ||
|
@@ -44,5 +49,22 @@ export class DemoComponent { | |
] | ||
} | ||
]; | ||
|
||
addRow(): void { | ||
this.st()?.addRow( | ||
{ | ||
id: 3, | ||
email: '[email protected]', | ||
picture: { | ||
thumbnail: 'https://randomuser.me/api/portraits/thumb/men/24.jpg' | ||
}, | ||
name: { | ||
first: 'first-11', | ||
last: ' last-1' | ||
} | ||
}, | ||
{ index: 0 } | ||
); | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters