mmhglobal-dynamicform 2.32.0 → 2.32.2

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.
@@ -9209,6 +9209,10 @@ class ZgridComponent extends DataListingFieldBase {
9209
9209
  if (this.data.UniqueKey && context.dataItem.Id) {
9210
9210
  console.error('A unique column field is required. Ensure either the Id column is present or the UniqueKey property is set for zgrid.');
9211
9211
  }
9212
+ // Initialize mySelection if it's undefined
9213
+ if (!this.mySelection) {
9214
+ this.mySelection = new Map();
9215
+ }
9212
9216
  // Store the data item in the mySelection map with the generated key.
9213
9217
  this.mySelection.set(key, context.dataItem);
9214
9218
  // Return the generated key.
@@ -9501,6 +9505,10 @@ class ZgridComponent extends DataListingFieldBase {
9501
9505
  this.editableColumns = this.columns.filter(s => s.isEditableInDataItem === true);
9502
9506
  this.editableColumns.map(s => Object.assign(dataItem, { [s.field]: formGroup.value[s.field] }));
9503
9507
  // this.mySelection.map(s => (s.Id === dataItem.Id) ? Object.assign(s, dataItem) : null);
9508
+ // Initialize mySelection if it's undefined
9509
+ if (!this.mySelection) {
9510
+ this.mySelection = new Map();
9511
+ }
9504
9512
  this.mySelection.forEach((value, key) => {
9505
9513
  if (value.Id === dataItem.Id) {
9506
9514
  this.mySelection.set(key, { ...value, ...dataItem });
@@ -9674,8 +9682,15 @@ class ZgridComponent extends DataListingFieldBase {
9674
9682
  return selectedRecord;
9675
9683
  }
9676
9684
  clearSelection() {
9677
- // Clear the map that stores selected data items.
9678
- this.mySelection.clear();
9685
+ // Check if mySelection is defined before trying to clear it
9686
+ if (this.mySelection) {
9687
+ // Clear the map that stores selected data items.
9688
+ this.mySelection.clear();
9689
+ }
9690
+ else {
9691
+ // Optionally, you can initialize it if it's undefined
9692
+ this.mySelection = new Map();
9693
+ }
9679
9694
  // Clear the array that tracks selected keys.
9680
9695
  this.rowSelection = [];
9681
9696
  }