jquery.dgtable 0.6.0 → 0.6.1

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,5 +1,5 @@
1
1
  /*!
2
- * jquery.dgtable 0.6.0
2
+ * jquery.dgtable 0.6.1
3
3
  * git://github.com/danielgindi/jquery.dgtable.git
4
4
  */
5
5
  (function (global, factory) {
@@ -7422,7 +7422,7 @@
7422
7422
  /**
7423
7423
  * @private
7424
7424
  * @field {number} estimatedRowHeight */
7425
- o.estimatedRowHeight = options.estimatedRowHeight === undefined ? 40 : options.estimatedRowHeight;
7425
+ o.estimatedRowHeight = options.estimatedRowHeight || undefined;
7426
7426
 
7427
7427
  /**
7428
7428
  * @private
@@ -7684,7 +7684,7 @@
7684
7684
  autoVirtualWrapperWidth: false,
7685
7685
  virtual: true,
7686
7686
  buffer: o.rowsBufferSize,
7687
- estimatedItemHeight: o.estimatedRowHeight || 40,
7687
+ estimatedItemHeight: o.estimatedRowHeight ? o.estimatedRowHeight : p.virtualRowHeight || 40,
7688
7688
  itemElementCreatorFn: function itemElementCreatorFn() {
7689
7689
  return createElement('div');
7690
7690
  },
@@ -10620,6 +10620,41 @@
10620
10620
 
10621
10621
  var tableClassName = o.tableClassName;
10622
10622
 
10623
+ // Calculate virtual row heights
10624
+ if (o.virtualTable && !p.virtualRowHeight) {
10625
+ var createDummyRow = function createDummyRow() {
10626
+ var row = createElement('div'),
10627
+ cell = row.appendChild(createElement('div')),
10628
+ cellInner = cell.appendChild(createElement('div'));
10629
+ row.className = tableClassName + '-row';
10630
+ cell.className = tableClassName + '-cell';
10631
+ cellInner.innerHTML = '0';
10632
+ row.style.visibility = 'hidden';
10633
+ row.style.position = 'absolute';
10634
+ return row;
10635
+ };
10636
+
10637
+ var $dummyTbody,$dummyWrapper = $('<div>').
10638
+ addClass(that.el.className).
10639
+ css({ 'z-index': -1, 'position': 'absolute', left: '0', top: '-9999px', width: '1px', overflow: 'hidden' }).
10640
+ append(
10641
+ $('<div>').addClass(tableClassName).append(
10642
+ $dummyTbody = $('<div>').addClass(tableClassName + '-body').css('width', 99999)));
10643
+
10644
+
10645
+
10646
+ $dummyWrapper.appendTo(document.body);
10647
+
10648
+ var row1 = createDummyRow(),row2 = createDummyRow(),row3 = createDummyRow();
10649
+ $dummyTbody.append(row1, row2, row3);
10650
+
10651
+ p.virtualRowHeightFirst = Css.getElementHeight(row1, true, true, true);
10652
+ p.virtualRowHeight = Css.getElementHeight(row2, true, true, true);
10653
+ p.virtualRowHeightLast = Css.getElementHeight(row3, true, true, true);
10654
+
10655
+ $dummyWrapper.remove();
10656
+ }
10657
+
10623
10658
  // Create inner table and tbody
10624
10659
  if (!p.$table) {
10625
10660