ngx-datatable not updating the footer's selected count message
See original GitHub issueI’m submitting a … (check one with “x”)
[x ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here
Current behavior When I am deleting rows from the table, the footer selected count message does not get updated when clearing the data and fetching the data again. Only the total rows message gets update…
Expected behavior The selected count message should get updated if they user is clearing the selected list.
is like this: 1 selected / 8 total --> but it should be like this: 0 selected / 7 total
Reproduction of the problem Create a table set the [selectionType]=“‘checkbox’”, and (select)=“onSelectItem($event)”
onSelectItem(selectedItems) {
this.selectedItemList.splice(0, this.selectedItemList.length);
this.selectedItemList.push(...selectedItems.selected);
}
Select some items in the table(they will be added to the selectedItemList. Delete the selected items, clear the selectedItemList and fetch the data again. The footer’s select count message is not getting updated only the total count message.
What is the motivation / use case for changing the behavior? The footer’s select count message needs to get updated together with the total count message.
Please tell us about your environment: Windows 7
-
Table version: 0.7.x 7.3.0
-
Angular version: 2.0.x Angular 4.0.1
-
Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ] Chrome 55.0.2883.87 m (64-bit)
-
Language: [all | TypeScript X.X | ES6/7 | ES5] Typescript 2.2.1
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:9 (1 by maintainers)
Top GitHub Comments
I’ve encountered this issue and here’s how I solve it. in your template
on your deleted handler
your footer count will reset to zero when setting
this.selected = []
ngx-datatable Footer component uses
selected
variable for its selected count https://github.com/swimlane/ngx-datatable/blob/3ac29923fecee83633fa77966fc74d2357d0c610/src/components/datatable.component.ts#L96My method
On your component let add more variable
checkAll = false;
On your selected handler function `
`
On Your Template
(select)="onSelect($event, !checkAll)"