jquery.dgtable 0.6.6 → 0.6.8

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jquery.dgtable",
3
3
  "description": "High-performance table View for jQuery",
4
- "version": "0.6.6",
4
+ "version": "0.6.8",
5
5
  "main": "dist/jquery.dgtable.cjs.min.js",
6
6
  "module": "dist/jquery.dgtable.es6.min.js",
7
7
  "broswer": "dist/jquery.dgtable.umd.min.js",
@@ -35,22 +35,22 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "@danielgindi/dom-utils": "^1.0.8",
38
- "@danielgindi/virtual-list-helper": "^1.0.7"
38
+ "@danielgindi/virtual-list-helper": "^1.0.8"
39
39
  },
40
40
  "devDependencies": {
41
- "@babel/core": "^7.20.2",
41
+ "@babel/core": "^7.20.5",
42
42
  "@babel/preset-env": "^7.20.2",
43
- "@babel/runtime": "^7.20.1",
44
- "@rollup/plugin-babel": "^6.0.2",
45
- "@rollup/plugin-commonjs": "^23.0.2",
43
+ "@babel/runtime": "^7.20.6",
44
+ "@rollup/plugin-babel": "^6.0.3",
45
+ "@rollup/plugin-commonjs": "^23.0.3",
46
46
  "@rollup/plugin-node-resolve": "^15.0.1",
47
- "core-js": "^3.26.0",
48
- "eslint": "^8.27.0",
47
+ "core-js": "^3.26.1",
48
+ "eslint": "^8.29.0",
49
49
  "eslint-formatter-codeframe": "^7.32.1",
50
- "fs-extra": "^10.1.0",
51
- "husky": "^8.0.1",
50
+ "fs-extra": "^11.1.0",
51
+ "husky": "^8.0.2",
52
52
  "pinst": "^3.0.0",
53
- "rollup": "^3.2.5",
53
+ "rollup": "^3.5.1",
54
54
  "rollup-plugin-terser": "^7.0.2"
55
55
  }
56
56
  }
package/src/index.js CHANGED
@@ -302,6 +302,9 @@ DGTable.prototype.initialize = function (options) {
302
302
  * @field {RowCollection} _filteredRows */
303
303
  p.filteredRows = null;
304
304
 
305
+ p.scrollbarWidth = 0;
306
+ p.lastVirtualScrollHeight = 0;
307
+
305
308
  this._setupHovers();
306
309
  };
307
310
 
@@ -460,6 +463,15 @@ DGTable.prototype._setupVirtualTable = function () {
460
463
 
461
464
  that.trigger('rowdestroy', row);
462
465
  },
466
+
467
+ onScrollHeightChange: height => {
468
+ // only recalculate scrollbar width if height increased. we reset it in other situations.
469
+ if (height > p._lastVirtualScrollHeight && !p.scrollbarWidth) {
470
+ this._updateLastCellWidthFromScrollbar();
471
+ }
472
+
473
+ p._lastVirtualScrollHeight = height;
474
+ },
463
475
  });
464
476
 
465
477
  p.virtualListHelper.setCount((p.filteredRows ?? p.rows).length);
@@ -659,8 +671,6 @@ DGTable.prototype.close = DGTable.prototype.remove = DGTable.prototype.destroy =
659
671
 
660
672
  this._destroyHeaderCells();
661
673
 
662
- p.virtualListHelper.destroy();
663
-
664
674
  if (p.$table) {
665
675
  p.$table.empty();
666
676
  }
@@ -769,8 +779,8 @@ DGTable.prototype.render = function () {
769
779
 
770
780
  p.virtualListHelper.setCount((p.filteredRows ?? p.rows).length);
771
781
 
782
+ this._updateVirtualHeight();
772
783
  this._updateLastCellWidthFromScrollbar(true);
773
-
774
784
  this._updateTableWidth(true);
775
785
 
776
786
  // Show sort arrows
@@ -1184,8 +1194,7 @@ DGTable.prototype.moveColumn = function (src, dest, visibleOnly = true) {
1184
1194
  this._ensureVisibleColumns();
1185
1195
 
1186
1196
  if (o.virtualTable) {
1187
- this.clearAndRender()
1188
- ._updateLastCellWidthFromScrollbar(true);
1197
+ this.clearAndRender();
1189
1198
  } else {
1190
1199
  let headerCell = p.$headerRow.find('>div.' + o.tableClassName + '-header-cell');
1191
1200
  let beforePos = srcOrder < destOrder ? destOrder + 1 : destOrder,
@@ -2278,8 +2287,6 @@ DGTable.prototype.removeRows = function (physicalRowIndex, count, render) {
2278
2287
  ._updateLastCellWidthFromScrollbar()
2279
2288
  .render()
2280
2289
  ._updateTableWidth(false); // Update table width to suit the required width considering vertical scrollbar
2281
-
2282
-
2283
2290
  } else {
2284
2291
  this.render()
2285
2292
  ._updateLastCellWidthFromScrollbar()
@@ -3453,7 +3460,9 @@ DGTable.prototype._updateVirtualHeight = function() {
3453
3460
  return this;
3454
3461
 
3455
3462
  if (o.virtualTable) {
3456
- p.tbody.style.height = p.virtualListHelper.estimateFullHeight() + 'px';
3463
+ const virtualHeight = p.virtualListHelper.estimateFullHeight();
3464
+ p.lastVirtualScrollHeight = virtualHeight;
3465
+ p.tbody.style.height = virtualHeight + 'px';
3457
3466
  } else {
3458
3467
  p.tbody.style.height = '';
3459
3468
  }