@nettyapps/ntybase 21.0.35-beta.22 → 21.0.35-beta.24

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.
@@ -1326,26 +1326,19 @@ class NettyAgGridBase extends NettyAppsBase {
1326
1326
  backClicked() {
1327
1327
  this.commonService.goBack();
1328
1328
  }
1329
- async refreshData() {
1330
- try {
1331
- this.loadData();
1332
- await this.alertService.showAlert('@dataRefreshedSuccessfully');
1333
- }
1334
- catch (err) {
1335
- this.alertService.showError(err);
1336
- }
1337
- }
1338
1329
  /** Set data into the grid */
1339
- setData(data) {
1330
+ setData(data, initialize = false) {
1340
1331
  this.recordList.set(data);
1341
1332
  if (this.columnDefs() == null || this.columnDefs().length == 0) {
1342
1333
  this.initAgGrid();
1343
1334
  }
1344
1335
  if (this.searchValue() && this.gridApi) {
1345
1336
  this.gridApi.setGridOption('quickFilterText', this.searchValue());
1346
- if (this.recordList == undefined || this.recordList.length == 0) {
1347
- if (this._isEmbedded()) {
1348
- this.alertService.showWarning('@recordNotFoundSearch');
1337
+ if (!initialize) {
1338
+ if (this.recordList == undefined || this.recordList.length == 0) {
1339
+ if (!this._isEmbedded()) {
1340
+ this.alertService.showWarning('@recordNotFoundSearch');
1341
+ }
1349
1342
  }
1350
1343
  }
1351
1344
  }
@@ -1789,7 +1782,7 @@ class NettyAgGridListBase extends NettyAgGridBase {
1789
1782
  // ********************************************
1790
1783
  // Filter section
1791
1784
  hasFilter = input(true, ...(ngDevMode ? [{ debugName: "hasFilter" }] : [])); // Does the component have a filter
1792
- _hasFilter = computed(() => this.hasFilter() ?? false, ...(ngDevMode ? [{ debugName: "_hasFilter" }] : []));
1785
+ _hasFilter = computed(() => this.hasFilter() ?? true, ...(ngDevMode ? [{ debugName: "_hasFilter" }] : []));
1793
1786
  isFilterValid = signal(true, ...(ngDevMode ? [{ debugName: "isFilterValid" }] : [])); // Can the filter be used
1794
1787
  isFilterExpanded = linkedSignal({ ...(ngDevMode ? { debugName: "isFilterExpanded" } : {}), source: () => ({
1795
1788
  embedded: this._isEmbedded(),
@@ -1840,9 +1833,7 @@ class NettyAgGridListBase extends NettyAgGridBase {
1840
1833
  if (savedSearchValue) {
1841
1834
  this.searchValue.set(savedSearchValue);
1842
1835
  }
1843
- if (!this._hasFilter()) {
1844
- this.loadData();
1845
- }
1836
+ this.loadData();
1846
1837
  // Load user grid preferences
1847
1838
  await this.nettyAgGridService.copyGridUserPereferenceToLocal(this.preferenceType());
1848
1839
  await this.AfterOnInit();
@@ -2023,16 +2014,30 @@ class NettyAgGridListBase extends NettyAgGridBase {
2023
2014
  // *********************************************************
2024
2015
  loadData() {
2025
2016
  if (this._hasFilter()) {
2026
- this.setData([]);
2017
+ this.setData([], true);
2027
2018
  return;
2028
2019
  }
2029
2020
  this.nettyAppsProxy.select(this.record).subscribe({
2030
2021
  next: (data) => {
2031
- this.setData(data);
2022
+ this.setData(data, false);
2032
2023
  },
2033
2024
  error: (err) => this.alertService.showError('@dataLoadFailed', err),
2034
2025
  });
2035
2026
  }
2027
+ async refreshData() {
2028
+ try {
2029
+ if (this._hasFilter()) {
2030
+ this.refreshFilterData();
2031
+ }
2032
+ else {
2033
+ this.loadData();
2034
+ }
2035
+ // await this.alertService.showAlert('@dataRefreshedSuccessfully');
2036
+ }
2037
+ catch (err) {
2038
+ this.alertService.showError(err);
2039
+ }
2040
+ }
2036
2041
  async deleteSelected() {
2037
2042
  if (!this.gridApi)
2038
2043
  return;
@@ -2110,7 +2115,7 @@ class NettyAgGridLogBase extends NettyAgGridBase {
2110
2115
  loadData() {
2111
2116
  this.nettyAppsProxy.selectLog(this.record).subscribe({
2112
2117
  next: (data) => {
2113
- this.setData(data);
2118
+ this.setData(data, false);
2114
2119
  },
2115
2120
  error: (err) => this.alertService.showError('@dataLoadFailed', err),
2116
2121
  });