@sumaris-net/ngx-components 1.5.9 → 1.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21523,9 +21523,17 @@ class AppTable {
21523
21523
  if (!canDelete)
21524
21524
  return 0; // Cannot delete
21525
21525
  if (this.saveBeforeDelete) {
21526
- // Cancel invalid rows (because of save() will failed if there is invalid rows)
21526
+ // Cancel invalid rows (because of save() will fail, if invalid rows exists)
21527
21527
  rows.filter(row => { var _a; return !((_a = row.validator) === null || _a === void 0 ? void 0 : _a.valid); })
21528
- .forEach(row => row.cancelOrDelete());
21528
+ .forEach(row => {
21529
+ const deleted = row.id === -1;
21530
+ row.cancelOrDelete();
21531
+ // When deleted (= newly created row) : decrement counter
21532
+ if (deleted) {
21533
+ this.visibleRowCount--;
21534
+ this.totalRowCount--;
21535
+ }
21536
+ });
21529
21537
  // If data need to be saved first: do it
21530
21538
  const saved = yield this.saveBeforeAction('delete');
21531
21539
  if (!saved) {
@@ -21543,10 +21551,9 @@ class AppTable {
21543
21551
  try {
21544
21552
  const deleteCount = rowsToDelete.length;
21545
21553
  yield this._dataSource.deleteAll(rowsToDelete);
21546
- // Update manually, even if watchALl().subscribe() will update this count,
21547
- // because of memory data service (see issue #
21548
- this.totalRowCount -= deleteCount;
21549
- this.visibleRowCount -= deleteCount;
21554
+ // DO not update manually, because watchALl().subscribe() will update this count
21555
+ //this.totalRowCount -= deleteCount;
21556
+ //this.visibleRowCount -= deleteCount;
21550
21557
  this.selection.clear();
21551
21558
  this.editedRow = undefined;
21552
21559
  this.markAsDirty({ emitEvent: false /*markForCheck() is called just after*/ });