jquery.dgtable 0.6.7 → 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.7",
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);
@@ -767,8 +779,8 @@ DGTable.prototype.render = function () {
767
779
 
768
780
  p.virtualListHelper.setCount((p.filteredRows ?? p.rows).length);
769
781
 
782
+ this._updateVirtualHeight();
770
783
  this._updateLastCellWidthFromScrollbar(true);
771
-
772
784
  this._updateTableWidth(true);
773
785
 
774
786
  // Show sort arrows
@@ -1182,8 +1194,7 @@ DGTable.prototype.moveColumn = function (src, dest, visibleOnly = true) {
1182
1194
  this._ensureVisibleColumns();
1183
1195
 
1184
1196
  if (o.virtualTable) {
1185
- this.clearAndRender()
1186
- ._updateLastCellWidthFromScrollbar(true);
1197
+ this.clearAndRender();
1187
1198
  } else {
1188
1199
  let headerCell = p.$headerRow.find('>div.' + o.tableClassName + '-header-cell');
1189
1200
  let beforePos = srcOrder < destOrder ? destOrder + 1 : destOrder,
@@ -2276,8 +2287,6 @@ DGTable.prototype.removeRows = function (physicalRowIndex, count, render) {
2276
2287
  ._updateLastCellWidthFromScrollbar()
2277
2288
  .render()
2278
2289
  ._updateTableWidth(false); // Update table width to suit the required width considering vertical scrollbar
2279
-
2280
-
2281
2290
  } else {
2282
2291
  this.render()
2283
2292
  ._updateLastCellWidthFromScrollbar()
@@ -3451,7 +3460,9 @@ DGTable.prototype._updateVirtualHeight = function() {
3451
3460
  return this;
3452
3461
 
3453
3462
  if (o.virtualTable) {
3454
- 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';
3455
3466
  } else {
3456
3467
  p.tbody.style.height = '';
3457
3468
  }