@wavemaker/app-runtime-wm-build 11.4.0-next.1417050 → 11.4.0-next.1417052

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.
@@ -189959,6 +189959,11 @@ $.widget("wm.datatable", {
189959
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
+ if (this.renderTableOnViewLess) {
189963
+ $tbody = this.gridElement.empty();
189964
+ this.hideLoadingIndicator();
189965
+ this.renderTableOnViewLess = false;
189966
+ }
189962
189967
  } else {
189963
189968
  $tbody = this.gridElement.empty();
189964
189969
  }
@@ -190426,17 +190431,40 @@ $.widget("wm.datatable", {
190426
190431
  }), 100);
190427
190432
  }
190428
190433
  },
190429
- addLoadMoreBtn: function(onDemandMsg, loadingdatamsg, cb) {
190430
- if (!this.options.isLastPage) {
190434
+ addLoadMoreBtn: function(onDemandMsg, loadingdatamsg, cb, infScroll) {
190435
+ var $btnEl;
190436
+ if (!this.options.isLastPage || infScroll) {
190431
190437
  var self = this;
190432
190438
  var $parenEl = $('<div class="on-demand-datagrid"><a class="app-button btn btn-block on-demand-load-btn"></a></div>');
190433
- var $btnEl = $parenEl.find("a");
190439
+ $btnEl = $parenEl.find("a");
190434
190440
  $btnEl.append(onDemandMsg);
190435
190441
  this.element.find(".app-grid-header-inner").append($parenEl);
190442
+ if (infScroll) {
190443
+ if (this.element.find(".on-demand-load-btn").length) {
190444
+ this.element.find(".on-demand-load-btn").text(this.options.viewlessmessage);
190445
+ }
190446
+ }
190436
190447
  $btnEl.on("click", (function(e) {
190437
- if (cb && typeof cb === "function") {
190438
- $btnEl.hide();
190448
+ var lastPage = self.options.getCurrentPage() == self.options.getPageCount();
190449
+ if (!lastPage) {
190439
190450
  self.showLoadingIndicator(loadingdatamsg, false);
190451
+ }
190452
+ if (!self.options.showviewlessbutton) {
190453
+ $btnEl.hide();
190454
+ }
190455
+ if (infScroll) {
190456
+ if (lastPage) {
190457
+ self.element.find(".on-demand-datagrid").remove();
190458
+ }
190459
+ }
190460
+ if (lastPage && self.options.showviewlessbutton) {
190461
+ $btnEl.hide();
190462
+ self.renderTableOnViewLess = true;
190463
+ self.renderPaginationOnViewLess = true;
190464
+ self.options.enableNavigation();
190465
+ self._renderGrid();
190466
+ }
190467
+ if (cb && typeof cb === "function") {
190440
190468
  cb(e);
190441
190469
  }
190442
190470
  }));
@@ -190463,7 +190491,17 @@ $.widget("wm.datatable", {
190463
190491
  hideLoadingIndicator: function(showLoadBtn, infScroll) {
190464
190492
  if (!showLoadBtn && !infScroll) {
190465
190493
  this.element.find(".loading-data-msg").hide();
190494
+ this.element.find(".on-demand-load-btn").text(this.options.ondemandmessage);
190466
190495
  this.element.find(".on-demand-load-btn").show();
190496
+ } else if (this.options.getCurrentPage() == this.options.getPageCount() && this.options.showviewlessbutton) {
190497
+ this.element.find(".on-demand-load-btn").show().text(this.options.viewlessmessage);
190498
+ this.element.find(".loading-data-msg").hide();
190499
+ if (infScroll) {
190500
+ if (!this.element.find(".on-demand-load-btn").length) {
190501
+ this.options.addLoadMoreBtn();
190502
+ }
190503
+ this.element.find(".loading-data-msg").hide();
190504
+ }
190467
190505
  } else {
190468
190506
  this.element.find(".on-demand-datagrid").hide();
190469
190507
  }
@@ -191999,7 +192037,9 @@ $.widget("wm.datatable", {
191999
192037
  if (this.options.summaryRow) {
192000
192038
  var $summaryRowHtm = $(this._getSummaryRowTemplate());
192001
192039
  this.tableContainer.find("tfoot").remove();
192002
- this.tableContainer.append($summaryRowHtm);
192040
+ if (this.options.data.length) {
192041
+ this.tableContainer.append($summaryRowHtm);
192042
+ }
192003
192043
  }
192004
192044
  if (!this.options.data.length && this.dataStatus.state === "nodata") {
192005
192045
  this.setStatus("nodata");
@@ -192009,7 +192049,7 @@ $.widget("wm.datatable", {
192009
192049
  this.setStatus(this.dataStatus.state, this.dataStatus.message, isCreated);
192010
192050
  }
192011
192051
  this.gridBody = this.gridElement.find("tbody");
192012
- this.gridFooter = this.gridElement.find("tfoot");
192052
+ this.gridFooter = this.tableContainer.find("tfoot");
192013
192053
  this._findAndReplaceCompiledTemplates();
192014
192054
  this.options.clearRowActions();
192015
192055
  this._appendRowExpansionButtons($htm);
@@ -192069,6 +192109,9 @@ $.widget("wm.datatable", {
192069
192109
  this._toggleSpacingClasses("condensed");
192070
192110
  }
192071
192111
  this._renderGrid(isCreated);
192112
+ this.addNavigationControls();
192113
+ },
192114
+ addNavigationControls: function() {
192072
192115
  if (this.options.isdynamictable) {
192073
192116
  this.element.find(".on-demand-datagrid").remove();
192074
192117
  if (this.options.navigation === "On-Demand" && !this.element.find(".on-demand-datagrid").length) {
@@ -192089,7 +192132,7 @@ $.widget("wm.datatable", {
192089
192132
  if (state === "ready") {
192090
192133
  this.dataStatusContainer.hide();
192091
192134
  } else {
192092
- if (this.options.isNavTypeScrollOrOndemand() && (state === "nodata" || this.options.isLastPage)) {
192135
+ if (this.options.isNavTypeScrollOrOndemand() && (state === "nodata" || this.options.getCurrentPage() == this.options.getPageCount() && !this.options.showviewlessbutton)) {
192093
192136
  this.element.find(".on-demand-datagrid a").hide();
192094
192137
  }
192095
192138
  this.dataStatusContainer.show();