@esfaenza/es-table 13.1.20 → 13.1.21

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.
@@ -3668,8 +3668,20 @@ class EsTableComponent {
3668
3668
  // In casi la gente si metta a spammare refresh con ngif strani sull'estable creandola e distruggendola N volte al secondo nel tempo che ci mette
3669
3669
  // a tirare su le preference da qui sopra la View potrebbe essere cambiata
3670
3670
  if (this.View) {
3671
- this.View.columns = prefs?.columns || [];
3672
- this.View.column_ordering = prefs?.column_ordering || [];
3671
+ let cols = prefs?.columns || [];
3672
+ let updatedPrefs = true;
3673
+ // Se le preferenze fanno riferimento a delle colonne che io non ho nella View attuale significa che
3674
+ // le preference stanno facendo riferimento a una versione vecchia dell'es-table, quindi non foccio operazioni
3675
+ for (let i = 0; i < this.View.columns.length; i++) {
3676
+ if (!cols.indexOf(this.View.columns[i])) {
3677
+ updatedPrefs = false;
3678
+ break;
3679
+ }
3680
+ }
3681
+ if (updatedPrefs) {
3682
+ this.View.columns = prefs?.columns || [];
3683
+ this.View.column_ordering = prefs?.column_ordering || [];
3684
+ }
3673
3685
  }
3674
3686
  }
3675
3687
  }
@@ -3692,6 +3704,16 @@ class EsTableComponent {
3692
3704
  console.error("Non posso utilizzare le preference senza che il pacchetto @esfaenza/preferences sia installato");
3693
3705
  else {
3694
3706
  var prefs = await this.prefService.getItem(this.ngControl.name).toPromise();
3707
+ let cols = prefs?.columns || [];
3708
+ let updatedPrefs = true;
3709
+ // Se le preferenze fanno riferimento a delle colonne che io non ho nella View attuale significa che
3710
+ // le preference stanno facendo riferimento a una versione vecchia dell'es-table, quindi non foccio operazioni
3711
+ for (let i = 0; i < this.arrayColumns.length; i++) {
3712
+ if (!cols.indexOf(this.arrayColumns[i])) {
3713
+ updatedPrefs = false;
3714
+ break;
3715
+ }
3716
+ }
3695
3717
  this.arrayColumns = prefs?.columns || [];
3696
3718
  this.arrayColumnOrdering = prefs?.column_ordering || [];
3697
3719
  }