@syncfusion/ej2-multicolumn-combobox 31.2.4 → 31.2.12

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.
@@ -267,6 +267,10 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
267
267
  }
268
268
  render() {
269
269
  this.renderInput();
270
+ if ((!isNullOrUndefined(this.value) || !isNullOrUndefined(this.text) || !isNullOrUndefined(this.index)) && !isNullOrUndefined(this.dataSource)
271
+ && this.dataSource instanceof DataManager) {
272
+ this.isInitialValueRender = true;
273
+ }
270
274
  if (this.gridData == null) {
271
275
  this.setGridData(this.dataSource);
272
276
  }
@@ -293,6 +297,10 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
293
297
  this.remoteDataLength = this.gridData.length;
294
298
  this.isMainDataUpdated = true;
295
299
  }
300
+ if (this.isInitialValueRender) {
301
+ this.isInitialValueRender = false;
302
+ this.initValue(null, null, true);
303
+ }
296
304
  if (this.popupDiv) {
297
305
  this.updateGridDataSource();
298
306
  }
@@ -410,7 +418,7 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
410
418
  SortOrder.Ascending : SortOrder.Descending }] };
411
419
  }
412
420
  this.gridObj.appendTo(this.gridEle);
413
- if (!isNullOrUndefined(this.value) || !isNullOrUndefined(this.text) || !isNullOrUndefined(this.index)) {
421
+ if ((!isNullOrUndefined(this.value) || !isNullOrUndefined(this.text) || !isNullOrUndefined(this.index)) && !isNullOrUndefined(this.dataSource) && this.dataSource instanceof Array) {
414
422
  this.initValue(null, null, true);
415
423
  }
416
424
  }
@@ -769,22 +777,21 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
769
777
  };
770
778
  if ((!isRerender && (!isNullOrUndefined(this.value) || !isNullOrUndefined(this.text))) || (isRerender && isValue !== undefined)) {
771
779
  const value = isRerender ? (isValue ? this.value : this.text) : (!isNullOrUndefined(this.value) ? this.value : this.text);
772
- if (!isNullOrUndefined(this.dataSource) && this.dataSource instanceof DataManager) {
773
- this.dataSource.executeQuery(new Query).then((e) => {
774
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
775
- const dataLists = e.result;
776
- const filteredData = dataLists.filter((item) => {
777
- const fieldVal = item ? (this.updateFieldValue(isRerender ? (isValue ? this.fields.value :
778
- this.fields.text) : !isNullOrUndefined(this.value) ? this.fields.value : this.fields.text, item)) : null;
779
- return fieldVal === value;
780
- });
781
- if (filteredData.length > 0) {
782
- item = filteredData[0];
783
- updateValues(dataLists);
784
- this.updateChangeEvent(item, prevItemData, prevItemEle, currentValue, currentText, currentIndex, isRerender, isInitial);
785
- this.gridObj.selectRow(this.index);
786
- }
780
+ if (!isNullOrUndefined(this.dataSource) && this.dataSource instanceof DataManager && this.mainData
781
+ && this.isMainDataUpdated) {
782
+ const dataLists = ((this.query && this.getQuery(this.query).isCountRequired) ||
783
+ !this.query) ? this.mainData : this.mainData.result ? this.mainData.result : this.mainData;
784
+ const filteredData = dataLists.filter((item) => {
785
+ const fieldVal = item ? (this.updateFieldValue(isRerender ? (isValue ? this.fields.value :
786
+ this.fields.text) : !isNullOrUndefined(this.value) ? this.fields.value : this.fields.text, item)) : null;
787
+ return fieldVal === value;
787
788
  });
789
+ if (filteredData.length > 0) {
790
+ item = filteredData[0];
791
+ updateValues(dataLists);
792
+ this.updateChangeEvent(item, prevItemData, prevItemEle, currentValue, currentText, currentIndex, isRerender, isInitial);
793
+ this.gridObj.selectRow(this.index);
794
+ }
788
795
  }
789
796
  else if (!isNullOrUndefined(this.dataSource) && this.dataSource instanceof Array) {
790
797
  item = this.dataSource.filter((data) => {
@@ -796,15 +803,14 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
796
803
  }
797
804
  }
798
805
  else if (!isNullOrUndefined(this.index)) {
799
- if (!isNullOrUndefined(this.dataSource) && this.dataSource instanceof DataManager) {
800
- this.dataSource.executeQuery(new Query).then((e) => {
801
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
802
- const dataLists = e.result;
803
- item = dataLists[this.index];
804
- updateValues(dataLists);
805
- this.updateChangeEvent(item, prevItemData, prevItemEle, currentValue, currentText, currentIndex, isRerender, isInitial);
806
- this.gridObj.selectRow(this.index);
807
- });
806
+ if (!isNullOrUndefined(this.dataSource) && this.dataSource instanceof DataManager && this.mainData
807
+ && this.isMainDataUpdated) {
808
+ const dataLists = ((this.query && this.getQuery(this.query).isCountRequired) ||
809
+ !this.query) ? this.mainData : this.mainData.result ? this.mainData.result : this.mainData;
810
+ item = dataLists[this.index];
811
+ updateValues(dataLists);
812
+ this.updateChangeEvent(item, prevItemData, prevItemEle, currentValue, currentText, currentIndex, isRerender, isInitial);
813
+ this.gridObj.selectRow(this.index);
808
814
  }
809
815
  else if (!isNullOrUndefined(this.dataSource) && this.dataSource instanceof Array) {
810
816
  if (!this.fields.groupBy) {
@@ -1607,15 +1613,14 @@ let MultiColumnComboBox = class MultiColumnComboBox extends Component {
1607
1613
  return fieldValue === value;
1608
1614
  })[0];
1609
1615
  }
1610
- else if (!isNullOrUndefined(this.dataSource) && this.dataSource instanceof DataManager) {
1611
- this.dataSource.executeQuery(new Query()).then((e) => {
1612
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1613
- const dataLists = e.result;
1614
- return dataLists.filter((item) => {
1615
- const fieldValue = this.updateFieldValue(this.fields.value, item);
1616
- return fieldValue === value;
1617
- })[0];
1618
- });
1616
+ else if (!isNullOrUndefined(this.dataSource) && this.dataSource instanceof DataManager && this.mainData
1617
+ && this.isMainDataUpdated) {
1618
+ const dataLists = ((this.query && this.getQuery(this.query).isCountRequired) ||
1619
+ !this.query) ? this.mainData : this.mainData.result ? this.mainData.result : this.mainData;
1620
+ return dataLists.filter((item) => {
1621
+ const fieldValue = this.updateFieldValue(this.fields.value, item);
1622
+ return fieldValue === value;
1623
+ })[0];
1619
1624
  }
1620
1625
  return null;
1621
1626
  }