@acorex/components 22.1.0-next.16 → 22.1.0-next.18

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.
@@ -2121,27 +2121,17 @@ class AXDataTableComponent extends AXBaseDataTable {
2121
2121
  this.applyDataPagerMethods();
2122
2122
  }
2123
2123
  this.rtl = AXHtmlUtil.isRtl(this.getHostElement());
2124
- this.dataSource.useCache = false;
2125
- if (this.fetchDataMode == 'auto') {
2126
- this.dataSource.setPage(0);
2127
- }
2128
- this.displayedRows.set(new Array(this.dataSource.pageSize));
2129
- this.totalRows = this.dataSource.items.length;
2130
2124
  this.dataSource.onLoadingChanged.pipe(this._unsubscriber.takeUntilDestroy).subscribe((data) => {
2131
2125
  this.isLoading.set(data);
2132
2126
  });
2127
+ this.isLoading.set(this.dataSource.isLoading);
2133
2128
  this.dataSource.onChanged.pipe(this._unsubscriber.takeUntilDestroy).subscribe((data) => {
2134
2129
  const shouldMoveToPreviousPage = data.totalCount > 0 && data.items.length === 0 && data.page > 0;
2135
2130
  if (shouldMoveToPreviousPage) {
2136
2131
  this.goToPage(data.page);
2137
2132
  return;
2138
2133
  }
2139
- this.clearResolvedCssClasses();
2140
- this.lastLoadedRows = data.items.filter((item) => !item[this.parentField]);
2141
- this.displayedRows.set(this.mergeRowsWithHighlights(this.lastLoadedRows));
2142
- this.totalRows = data.totalCount;
2143
- this.hasItems = data.totalCount > 0;
2144
- this.scheduleTextHighlight();
2134
+ this.applyLoadedRows(data.items, data.totalCount);
2145
2135
  });
2146
2136
  this.dataSource.onItemExpanded.pipe(this._unsubscriber.takeUntilDestroy).subscribe((data) => {
2147
2137
  const { expandedItem, children } = data;
@@ -2158,6 +2148,21 @@ class AXDataTableComponent extends AXBaseDataTable {
2158
2148
  this.refreshExpandedItem(id);
2159
2149
  });
2160
2150
  this.pageSize.set(this.dataSource.pageSize);
2151
+ const existingItems = (this.dataSource.items ?? []).filter((item) => item != null);
2152
+ if (existingItems.length > 0) {
2153
+ // Popup/lookup remounts this table; setPage(0) is a no-op on a warm source and
2154
+ // would leave the default skeleton rows in place. Paint cached rows instead of refetching.
2155
+ this.applyLoadedRows(existingItems, this.dataSource.totalCount || existingItems.length);
2156
+ this.isLoading.set(false);
2157
+ }
2158
+ else {
2159
+ this.dataSource.useCache = false;
2160
+ if (this.fetchDataMode == 'auto') {
2161
+ this.dataSource.setPage(0);
2162
+ }
2163
+ this.displayedRows.set(new Array(this.dataSource.pageSize));
2164
+ this.totalRows = this.dataSource.items.length;
2165
+ }
2161
2166
  //
2162
2167
  this.clickSubject
2163
2168
  .pipe(buffer(this.clickSubject.pipe(debounceTime(250))), filter((clickArray) => clickArray.length === 2))
@@ -2165,6 +2170,14 @@ class AXDataTableComponent extends AXBaseDataTable {
2165
2170
  this.handleRowDoubleClick(clickArray[0].event, clickArray[0].item);
2166
2171
  });
2167
2172
  }
2173
+ applyLoadedRows(items, totalCount) {
2174
+ this.clearResolvedCssClasses();
2175
+ this.lastLoadedRows = items.filter((item) => item != null && !item[this.parentField]);
2176
+ this.displayedRows.set(this.mergeRowsWithHighlights(this.lastLoadedRows));
2177
+ this.totalRows = totalCount;
2178
+ this.hasItems = totalCount > 0;
2179
+ this.scheduleTextHighlight();
2180
+ }
2168
2181
  /**
2169
2182
  * @ignore
2170
2183
  */