Skip to content

Commit 146ae77

Browse files
committed
fix: dataTable getCheckedRows API change since 8.0.0
1 parent 569ab96 commit 146ae77

3 files changed

Lines changed: 6 additions & 10 deletions

File tree

src/app/admin/article-management/article-list/article-list.component.css

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@
1212
margin-left: 16px;
1313
}
1414

15-
.operation-area ::ng-deep .devui-pagination .pagination{
15+
.operation-area ::ng-deep .devui-pagination .devui-pagination-list {
1616
margin: 0!important;
1717
}
18-
.more-operation {
19-
vertical-align: top;
20-
}
18+
2119
.single-pagination {
2220
text-align: right;
2321
}

src/app/admin/article-management/article-list/article-list.component.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
[dataSource]="articleList"
3737
[type]="'striped'"
3838
[checkable]="true"
39-
(getCheckedRows)="getCheckedRows($event)"
4039
>
4140

4241
<d-column [header]="'标题'" [field]="'title'" [width]="'400px'"></d-column>

src/app/admin/article-management/article-list/article-list.component.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
import { Component, OnInit, OnDestroy } from '@angular/core';
1+
import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
22
import { Router, ActivatedRoute, ActivatedRouteSnapshot } from '@angular/router';
33
import { Subscription } from 'rxjs';
44
import { HttpClient } from '@angular/common/http';
5-
import { DialogService } from 'ng-devui';
5+
import { DialogService, DataTableComponent } from 'ng-devui';
66

77
@Component({
88
selector: 'app-article-list',
99
templateUrl: './article-list.component.html',
1010
styleUrls: ['./article-list.component.css']
1111
})
1212
export class ArticleListComponent implements OnInit , OnDestroy {
13+
@ViewChild(DataTableComponent, {static: false}) dataTable: DataTableComponent;
1314
showFilterPanel = false;
1415
subscription: Subscription;
1516
activeListType: string;
@@ -114,9 +115,6 @@ export class ArticleListComponent implements OnInit , OnDestroy {
114115
this.filterOption = event;
115116
this.getData();
116117
}
117-
getCheckedRows(event) {
118-
this.checkRows = event;
119-
}
120118

121119
delete(ids, batch= false) {
122120
let tips;
@@ -169,6 +167,7 @@ export class ArticleListComponent implements OnInit , OnDestroy {
169167
});
170168
}
171169
batchDelete() {
170+
this.checkRows = this.dataTable.getCheckedRows();
172171
if (!this.checkRows || !this.checkRows.length) { return; }
173172
const ids = this.checkRows.map(row => row.id);
174173
this.delete(ids, true);

0 commit comments

Comments
 (0)