@wavemaker/app-runtime-wm-build 11.4.0-next.1417031 → 11.4.0-next.1417033

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.
@@ -189956,12 +189956,11 @@ $.widget("wm.datatable", {
189956
189956
  }
189957
189957
  },
189958
189958
  _getGridTemplate: function() {
189959
- var self = this, preparedData, $tbody, tbodyExists, pageStartIndex = self.getPageStartIndex(), startRowIndex = self.options.startRowIndex, isScrollorOnDemand = self.options.isNavTypeScrollOrOndemand();
189959
+ var self = this, preparedData, $tbody, pageStartIndex = self.getPageStartIndex(), startRowIndex = self.options.startRowIndex, isScrollorOnDemand = self.options.isNavTypeScrollOrOndemand();
189960
189960
  if (isScrollorOnDemand) {
189961
189961
  $tbody = this.gridElement;
189962
189962
  } else {
189963
- tbodyExists = this.gridElement.find("tbody").length;
189964
- $tbody = tbodyExists > 0 ? this.gridElement.find("tbody:first") : this.gridElement.empty();
189963
+ $tbody = this.gridElement.empty();
189965
189964
  }
189966
189965
  if (isScrollorOnDemand) {
189967
189966
  this._handleCRUDForInfiniteScroll($tbody);
@@ -190679,6 +190678,9 @@ $.widget("wm.datatable", {
190679
190678
  break;
190680
190679
 
190681
190680
  case "data":
190681
+ if (!this.isResetSortIconsDone) {
190682
+ this.setSortIconDefault();
190683
+ }
190682
190684
  this.refreshGridData();
190683
190685
  break;
190684
190686
 
@@ -191437,6 +191439,7 @@ $.widget("wm.datatable", {
191437
191439
  }));
191438
191440
  },
191439
191441
  resetSortIcons: function($el) {
191442
+ this.isResetSortIconsDone = true;
191440
191443
  var $sortContainer;
191441
191444
  if (!$el && this.gridHeaderElement) {
191442
191445
  $sortContainer = this.gridHeaderElement.find(".sort-buttons-container.active");
@@ -191445,12 +191448,22 @@ $.widget("wm.datatable", {
191445
191448
  }
191446
191449
  $el.removeClass("desc asc").removeClass(this.options.cssClassNames.descIcon).removeClass(this.options.cssClassNames.ascIcon);
191447
191450
  },
191451
+ setSortIconDefault: function() {
191452
+ const sortInfo = this.options.sortInfo, $e = this.tableContainer, $th = $e.find("[data-col-field='" + sortInfo.field + "']"), $sortContainer = $th.find(".sort-buttons-container"), $sortIcon = $sortContainer.find("i.sort-icon"), direction = sortInfo.direction;
191453
+ if (direction === "asc") {
191454
+ $sortIcon.addClass(direction + " " + this.options.cssClassNames.ascIcon);
191455
+ $sortContainer.addClass("active");
191456
+ } else if (direction === "desc") {
191457
+ $sortIcon.addClass(direction + " " + this.options.cssClassNames.descIcon);
191458
+ $sortContainer.addClass("active");
191459
+ }
191460
+ },
191448
191461
  sortHandler: function(e) {
191449
191462
  e.stopImmediatePropagation();
191450
191463
  if ($(e.target).hasClass("header-data") && this.options.enableColumnSelection) {
191451
191464
  this.headerClickHandler(e);
191452
191465
  }
191453
- var $e = $(e.target), $th = $e.closest("th.app-datagrid-header-cell"), id = $th.attr("data-col-id"), $sortContainer = $th.find(".sort-buttons-container"), $sortIcon = $sortContainer.find("i.sort-icon"), direction = $sortIcon.hasClass("asc") ? "desc" : $sortIcon.hasClass("desc") ? "" : "asc", sortInfo = this.options.sortInfo, $previousSortMarker = this.gridHeaderElement.find(".sort-buttons-container.active"), field = $th.attr("data-col-field"), $previousSortedColumn, $previousSortIcon, colId, colDef;
191466
+ var $e = $(e.target), $th = $e.closest("th.app-datagrid-header-cell"), id = $th.attr("data-col-id"), $sortContainer = $th.find(".sort-buttons-container"), $sortIcon = $sortContainer.find("i.sort-icon"), direction = $sortIcon.hasClass("asc") ? "desc" : "asc", sortInfo = this.options.sortInfo, $previousSortMarker = this.gridHeaderElement.find(".sort-buttons-container.active"), field = $th.attr("data-col-field"), $previousSortedColumn, $previousSortIcon, colId, colDef;
191454
191467
  this.resetSortIcons($sortIcon);
191455
191468
  $sortIcon.addClass(direction);
191456
191469
  if (direction === "asc") {
@@ -191921,6 +191934,9 @@ $.widget("wm.datatable", {
191921
191934
  }
191922
191935
  });
191923
191936
  }
191937
+ if (!this.isResetSortIconsDone) {
191938
+ this.setSortIconDefault();
191939
+ }
191924
191940
  },
191925
191941
  addOrRemoveScroll: function() {
191926
191942
  var gridContent = this.gridContainer.find("tbody"), gridHeader = this.gridContainer.find(".table-header");