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.
@@ -9240,6 +9240,10 @@ class ZgridComponent extends DataListingFieldBase {
9240
9240
  if (this.data.UniqueKey && context.dataItem.Id) {
9241
9241
  console.error('A unique column field is required. Ensure either the Id column is present or the UniqueKey property is set for zgrid.');
9242
9242
  }
9243
+ // Initialize mySelection if it's undefined
9244
+ if (!this.mySelection) {
9245
+ this.mySelection = new Map();
9246
+ }
9243
9247
  // Store the data item in the mySelection map with the generated key.
9244
9248
  this.mySelection.set(key, context.dataItem);
9245
9249
  // Return the generated key.
@@ -9534,6 +9538,10 @@ class ZgridComponent extends DataListingFieldBase {
9534
9538
  this.editableColumns = this.columns.filter(s => s.isEditableInDataItem === true);
9535
9539
  this.editableColumns.map(s => Object.assign(dataItem, { [s.field]: formGroup.value[s.field] }));
9536
9540
  // this.mySelection.map(s => (s.Id === dataItem.Id) ? Object.assign(s, dataItem) : null);
9541
+ // Initialize mySelection if it's undefined
9542
+ if (!this.mySelection) {
9543
+ this.mySelection = new Map();
9544
+ }
9537
9545
  this.mySelection.forEach((value, key) => {
9538
9546
  if (value.Id === dataItem.Id) {
9539
9547
  this.mySelection.set(key, Object.assign(Object.assign({}, value), dataItem));
@@ -9707,8 +9715,15 @@ class ZgridComponent extends DataListingFieldBase {
9707
9715
  return selectedRecord;
9708
9716
  }
9709
9717
  clearSelection() {
9710
- // Clear the map that stores selected data items.
9711
- this.mySelection.clear();
9718
+ // Check if mySelection is defined before trying to clear it
9719
+ if (this.mySelection) {
9720
+ // Clear the map that stores selected data items.
9721
+ this.mySelection.clear();
9722
+ }
9723
+ else {
9724
+ // Optionally, you can initialize it if it's undefined
9725
+ this.mySelection = new Map();
9726
+ }
9712
9727
  // Clear the array that tracks selected keys.
9713
9728
  this.rowSelection = [];
9714
9729
  }