@wavemaker/app-runtime-wm-build 11.4.0-next.1417051 → 11.4.0-next.1417053

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wavemaker/app-runtime-wm-build",
3
- "version": "11.4.0-next.1417051",
3
+ "version": "11.4.0-next.1417053",
4
4
  "description": "All modules required for a wavemaker application.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -166188,6 +166188,11 @@ $.widget("wm.datatable", {
166188
166188
  var self = this, preparedData, $tbody, pageStartIndex = self.getPageStartIndex(), startRowIndex = self.options.startRowIndex, isScrollorOnDemand = self.options.isNavTypeScrollOrOndemand();
166189
166189
  if (isScrollorOnDemand) {
166190
166190
  $tbody = this.gridElement;
166191
+ if (this.renderTableOnViewLess) {
166192
+ $tbody = this.gridElement.empty();
166193
+ this.hideLoadingIndicator();
166194
+ this.renderTableOnViewLess = false;
166195
+ }
166191
166196
  } else {
166192
166197
  $tbody = this.gridElement.empty();
166193
166198
  }
@@ -166655,17 +166660,40 @@ $.widget("wm.datatable", {
166655
166660
  }), 100);
166656
166661
  }
166657
166662
  },
166658
- addLoadMoreBtn: function(onDemandMsg, loadingdatamsg, cb) {
166659
- if (!this.options.isLastPage) {
166663
+ addLoadMoreBtn: function(onDemandMsg, loadingdatamsg, cb, infScroll) {
166664
+ var $btnEl;
166665
+ if (!this.options.isLastPage || infScroll) {
166660
166666
  var self = this;
166661
166667
  var $parenEl = $('<div class="on-demand-datagrid"><a class="app-button btn btn-block on-demand-load-btn"></a></div>');
166662
- var $btnEl = $parenEl.find("a");
166668
+ $btnEl = $parenEl.find("a");
166663
166669
  $btnEl.append(onDemandMsg);
166664
166670
  this.element.find(".app-grid-header-inner").append($parenEl);
166671
+ if (infScroll) {
166672
+ if (this.element.find(".on-demand-load-btn").length) {
166673
+ this.element.find(".on-demand-load-btn").text(this.options.viewlessmessage);
166674
+ }
166675
+ }
166665
166676
  $btnEl.on("click", (function(e) {
166666
- if (cb && typeof cb === "function") {
166667
- $btnEl.hide();
166677
+ var lastPage = self.options.getCurrentPage() == self.options.getPageCount();
166678
+ if (!lastPage) {
166668
166679
  self.showLoadingIndicator(loadingdatamsg, false);
166680
+ }
166681
+ if (!self.options.showviewlessbutton) {
166682
+ $btnEl.hide();
166683
+ }
166684
+ if (infScroll) {
166685
+ if (lastPage) {
166686
+ self.element.find(".on-demand-datagrid").remove();
166687
+ }
166688
+ }
166689
+ if (lastPage && self.options.showviewlessbutton) {
166690
+ $btnEl.hide();
166691
+ self.renderTableOnViewLess = true;
166692
+ self.renderPaginationOnViewLess = true;
166693
+ self.options.enableNavigation();
166694
+ self._renderGrid();
166695
+ }
166696
+ if (cb && typeof cb === "function") {
166669
166697
  cb(e);
166670
166698
  }
166671
166699
  }));
@@ -166692,7 +166720,17 @@ $.widget("wm.datatable", {
166692
166720
  hideLoadingIndicator: function(showLoadBtn, infScroll) {
166693
166721
  if (!showLoadBtn && !infScroll) {
166694
166722
  this.element.find(".loading-data-msg").hide();
166723
+ this.element.find(".on-demand-load-btn").text(this.options.ondemandmessage);
166695
166724
  this.element.find(".on-demand-load-btn").show();
166725
+ } else if (this.options.getCurrentPage() == this.options.getPageCount() && this.options.showviewlessbutton) {
166726
+ this.element.find(".on-demand-load-btn").show().text(this.options.viewlessmessage);
166727
+ this.element.find(".loading-data-msg").hide();
166728
+ if (infScroll) {
166729
+ if (!this.element.find(".on-demand-load-btn").length) {
166730
+ this.options.addLoadMoreBtn();
166731
+ }
166732
+ this.element.find(".loading-data-msg").hide();
166733
+ }
166696
166734
  } else {
166697
166735
  this.element.find(".on-demand-datagrid").hide();
166698
166736
  }
@@ -168228,7 +168266,9 @@ $.widget("wm.datatable", {
168228
168266
  if (this.options.summaryRow) {
168229
168267
  var $summaryRowHtm = $(this._getSummaryRowTemplate());
168230
168268
  this.tableContainer.find("tfoot").remove();
168231
- this.tableContainer.append($summaryRowHtm);
168269
+ if (this.options.data.length) {
168270
+ this.tableContainer.append($summaryRowHtm);
168271
+ }
168232
168272
  }
168233
168273
  if (!this.options.data.length && this.dataStatus.state === "nodata") {
168234
168274
  this.setStatus("nodata");
@@ -168238,7 +168278,7 @@ $.widget("wm.datatable", {
168238
168278
  this.setStatus(this.dataStatus.state, this.dataStatus.message, isCreated);
168239
168279
  }
168240
168280
  this.gridBody = this.gridElement.find("tbody");
168241
- this.gridFooter = this.gridElement.find("tfoot");
168281
+ this.gridFooter = this.tableContainer.find("tfoot");
168242
168282
  this._findAndReplaceCompiledTemplates();
168243
168283
  this.options.clearRowActions();
168244
168284
  this._appendRowExpansionButtons($htm);
@@ -168298,6 +168338,9 @@ $.widget("wm.datatable", {
168298
168338
  this._toggleSpacingClasses("condensed");
168299
168339
  }
168300
168340
  this._renderGrid(isCreated);
168341
+ this.addNavigationControls();
168342
+ },
168343
+ addNavigationControls: function() {
168301
168344
  if (this.options.isdynamictable) {
168302
168345
  this.element.find(".on-demand-datagrid").remove();
168303
168346
  if (this.options.navigation === "On-Demand" && !this.element.find(".on-demand-datagrid").length) {
@@ -168318,7 +168361,7 @@ $.widget("wm.datatable", {
168318
168361
  if (state === "ready") {
168319
168362
  this.dataStatusContainer.hide();
168320
168363
  } else {
168321
- if (this.options.isNavTypeScrollOrOndemand() && (state === "nodata" || this.options.isLastPage)) {
168364
+ if (this.options.isNavTypeScrollOrOndemand() && (state === "nodata" || this.options.getCurrentPage() == this.options.getPageCount() && !this.options.showviewlessbutton)) {
168322
168365
  this.element.find(".on-demand-datagrid a").hide();
168323
168366
  }
168324
168367
  this.dataStatusContainer.show();