@syncfusion/ej2-lists 32.1.19 → 32.1.23

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.
@@ -4031,6 +4031,7 @@ class Virtualization {
4031
4031
  }
4032
4032
  }
4033
4033
  }
4034
+ this.setItemContext(args.item, args.curData, !!args.curData.isHeader);
4034
4035
  }
4035
4036
  reRenderUiVirtualization() {
4036
4037
  this.wireScrollEvent(true);
@@ -4051,9 +4052,12 @@ class Virtualization {
4051
4052
  element.dataset.uid = (curViewDS[this.listViewInstance.fields.id]) ?
4052
4053
  (curViewDS[this.listViewInstance.fields.id]) : ListBase.generateId();
4053
4054
  onChange(curViewDS, element, this);
4055
+ this.setItemContext(element, curViewDS, !!curViewDS.isHeader);
4054
4056
  }
4055
4057
  else {
4056
4058
  this.updateUiContent(element, index);
4059
+ const curViewDS = this.listViewInstance.curViewDS[index];
4060
+ this.setItemContext(element, curViewDS, !!curViewDS.isHeader);
4057
4061
  }
4058
4062
  this.changeElementAttributes(element, index);
4059
4063
  if (targetElement) {
@@ -4079,6 +4083,7 @@ class Virtualization {
4079
4083
  [].slice.call(liItem[0].children).forEach((ele) => {
4080
4084
  listElement.appendChild(ele);
4081
4085
  });
4086
+ virtualThis.setItemContext(listElement, newData, !!newData.isHeader);
4082
4087
  }
4083
4088
  onNgChange(newData, listElement, virtualThis) {
4084
4089
  // compile given target element with template for new data
@@ -4088,6 +4093,7 @@ class Virtualization {
4088
4093
  listElement.removeChild(listElement.lastChild);
4089
4094
  }
4090
4095
  listElement.appendChild(resultElement[0]);
4096
+ virtualThis.setItemContext(listElement, newData, !!newData.isHeader);
4091
4097
  }
4092
4098
  getModuleName() {
4093
4099
  return 'virtualization';
@@ -4097,6 +4103,14 @@ class Virtualization {
4097
4103
  this.topElement = null;
4098
4104
  this.bottomElement = null;
4099
4105
  }
4106
+ setItemContext(item, curData, isHeader) {
4107
+ const el = item;
4108
+ const existing = (el.context || {});
4109
+ el.context = Object.assign({}, existing, { data: curData, nodes: existing.nodes || { flatTemplateNodes: [], groupTemplateNodes: [] }, type: isHeader ? 'groupList' : 'flatList' });
4110
+ if (item.firstElementChild) {
4111
+ el.context.template = item.firstElementChild;
4112
+ }
4113
+ }
4100
4114
  }
4101
4115
 
4102
4116
  var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {