refs #5410 fix: se mantenien los checkbox marcados al paginar
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Vicent Llopis 2023-03-15 08:40:53 +01:00
parent 4e0567eb0c
commit 38bf49c0b6
2 changed files with 31 additions and 15 deletions

View File

@ -5,6 +5,7 @@
limit="20"
order="amount DESC"
data="defaulters"
on-data-change="$ctrl.reCheck()"
auto-load="true">
</vn-crud-model>
<vn-portal slot="topbar">
@ -90,6 +91,7 @@
<td shrink>
<vn-check
ng-model="defaulter.checked"
on-change="$ctrl.saveChecked(defaulter.clientFk)"
vn-click-stop>
</vn-check>
</td>

View File

@ -6,6 +6,7 @@ export default class Controller extends Section {
constructor($element, $) {
super($element, $);
this.defaulter = {};
this.checkedDefaulers = [];
this.smartTableOptions = {
activeButtons: {
@ -68,6 +69,19 @@ export default class Controller extends Section {
return checkedLines;
}
saveChecked(clientId) {
this.checkedDefaulers = this.checkedDefaulers.includes(clientId) ?
this.checkedDefaulers.filter(id => id !== clientId) : [...this.checkedDefaulers, clientId];
}
reCheck() {
if (!this.$.model.data || !this.checkedDefaulers.length) return;
this.$.model.data.forEach(defaulter => {
defaulter.checked = this.checkedDefaulers.includes(defaulter.clientFk);
});
}
getBalanceDueTotal() {
this.$http.get('Defaulters/filter')
.then(res => {