tabulator-rails 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0ce02d77017861dca0b48e89de5f680788e3160d
4
- data.tar.gz: 921d059fa75bdfb5808f9ade0f369d23a1669d7f
3
+ metadata.gz: e09d2791c9a4a2cc558b7308f7907fe504230174
4
+ data.tar.gz: d4838f6293b296a720dd13db6ae90ed75a3d9015
5
5
  SHA512:
6
- metadata.gz: 498b690ed246ed07a1047542d8e4a7cab7f6f604dd2b59bc471acffd909ccb14ae49e7159c2de7971c44ed16c89fe46c633dd630c2c005b7b06a185ea94fe964
7
- data.tar.gz: 771a02f54efe79a16bb81b1d1f32821e8f544903c0f085f17673c725dd416f1ef685fcf13170182de1087d39cb9d9bcaec43f5df618a2e179e15f24d247a64ae
6
+ metadata.gz: 6f741a1fb44fa629b7edf0a61ed99376e82b8a0e2cf0b4a609aff1e3b5a3dc02b4179157cfe61d9ea220285f0b17e1ae49fa7e1c83958834b1dd63d0bf37cd2e
7
+ data.tar.gz: ef226021e9f051c3369913ff2021f738c8b334edac1485f10352eb5e88bafbb433ccc3f468d5bf8a42a839b6abb8f32acfdb13ff70f27e6476c98073ea5d6263
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tabulator-rails (0.1.0)
4
+ tabulator-rails (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -26,22 +26,22 @@ Or install it yourself as:
26
26
  $ gem install tabulator-rails
27
27
 
28
28
 
29
- And then edit your app/assets/stylesheets/application.css file to look something like:
29
+ And then edit your app/assets/stylesheets/application.js file to look something like:
30
30
  ``` css
31
31
  /*
32
32
  *= require_self
33
33
  *= require jqeury
34
34
  *= require jquery-ui
35
- *= require tabulator-rails
35
+ *= require tabulator
36
36
  *= require_tree .
37
37
  */
38
38
  ```
39
39
 
40
- tabulator-rails is dependant on jQuery, jQuery-UI, so make sure you have it in your Gemfile.
40
+ **tabulator-rails is dependant on jQuery, jQuery-UI, so make sure you have it in your Gemfile.**
41
41
 
42
42
  And to your app/assets/stylesheets/application.css
43
43
  ``` css
44
- *= require tabulator-rails
44
+ *= require tabulator
45
45
  ```
46
46
 
47
47
  ## Usage
data/VERSIONS.md CHANGED
@@ -4,4 +4,5 @@
4
4
  |--------|-----------|
5
5
  | 0.1.0 | 3.3.3
6
6
  | 0.1.1 | 3.3.3
7
+ | 0.2.0 | 3.4.0
7
8
 
@@ -1,5 +1,5 @@
1
1
  module Tabulator
2
2
  module Rails
3
- VERSION = "0.1.1"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
4
4
 
5
- /* Tabulator v3.3.3 (c) Oliver Folkerd */
5
+ /* Tabulator v3.4.0 (c) Oliver Folkerd */
6
6
 
7
7
  /*
8
8
  * This file is part of the Tabulator package.
@@ -570,9 +570,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
570
570
  this.table.options.columnMoved(from.getComponent(), this.table.columnManager.getComponents());
571
571
  }
572
572
 
573
- if (this.table.options.persistentLayout && this.table.extExists("persistentLayout", true)) {
573
+ if (this.table.options.persistentLayout && this.table.extExists("persistence", true)) {
574
574
 
575
- this.table.extensions.persistentLayout.save();
575
+ this.table.extensions.persistence.save("columns");
576
576
  }
577
577
  };
578
578
 
@@ -615,6 +615,23 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
615
615
  }
616
616
  };
617
617
 
618
+ ColumnManager.prototype.scrollToColumn = function (column) {
619
+
620
+ var left;
621
+
622
+ if (column.visible) {
623
+
624
+ left = column.element.position().left + this.element.scrollLeft() + column.element.innerWidth() - this.headersElement.innerWidth();
625
+
626
+ this.table.rowManager.scrollHorizontal(left);
627
+
628
+ this.scrollHorizontal(left);
629
+ } else {
630
+
631
+ console.warn("Scroll Error - Column not visible");
632
+ }
633
+ };
634
+
618
635
  //////////////// Cell Management /////////////////
619
636
 
620
637
 
@@ -801,9 +818,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
801
818
 
802
819
  if (force) {
803
820
 
804
- if (this.table.options.persistentLayout && this.table.extExists("persistentLayout", true)) {
821
+ if (this.table.options.persistentLayout && this.table.extExists("persistence", true)) {
805
822
 
806
- this.table.extensions.persistentLayout.save();
823
+ this.table.extensions.persistence.save("columns");
807
824
  }
808
825
 
809
826
  if (this.table.extExists("columnCalcs")) {
@@ -887,6 +904,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
887
904
  return this.column;
888
905
  };
889
906
 
907
+ ColumnComponent.prototype.scrollTo = function () {
908
+
909
+ this.column.table.columManager.scrollToColumn(this.column);
910
+ };
911
+
890
912
  var Column = function Column(def, parent) {
891
913
 
892
914
  var self = this;
@@ -1269,6 +1291,23 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
1269
1291
 
1270
1292
  self.cellEvents.cellTapHold = def.cellTapHold;
1271
1293
  }
1294
+
1295
+ //setup column cell edit callbacks
1296
+
1297
+ if (typeof def.cellEdited == "function") {
1298
+
1299
+ self.cellEvents.cellEdited = def.cellEdited;
1300
+ }
1301
+
1302
+ if (typeof def.cellEditing == "function") {
1303
+
1304
+ self.cellEvents.cellEditing = def.cellEditing;
1305
+ }
1306
+
1307
+ if (typeof def.cellEditCancelled == "function") {
1308
+
1309
+ self.cellEvents.cellEditCancelled = def.cellEditCancelled;
1310
+ }
1272
1311
  };
1273
1312
 
1274
1313
  //build header element for header
@@ -1556,12 +1595,15 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
1556
1595
 
1557
1596
  Column.prototype.verticalAlign = function (alignment) {
1558
1597
 
1559
- if (this.parent.isGroup) {
1598
+ //calculate height of column header and group holder element
1560
1599
 
1561
- this.element.css("height", this.parent.getGroupElement().innerHeight());
1562
- } else {
1600
+ var parentHeight = this.parent.isGroup ? this.parent.getGroupElement().innerHeight() : this.parent.getHeadersElement().innerHeight();
1601
+
1602
+ this.element.css("height", parentHeight);
1603
+
1604
+ if (this.isGroup) {
1563
1605
 
1564
- this.element.css("height", this.parent.getHeadersElement().innerHeight());
1606
+ this.groupElement.css("min-height", parentHeight - this.contentElement.outerHeight());
1565
1607
  }
1566
1608
 
1567
1609
  //vertically align cell contents
@@ -1591,6 +1633,8 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
1591
1633
 
1592
1634
  this.element.css("height", "");
1593
1635
 
1636
+ this.element.css("min-height", "");
1637
+
1594
1638
  this.columns.forEach(function (column) {
1595
1639
 
1596
1640
  column.clearVerticalAlign();
@@ -1757,9 +1801,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
1757
1801
  cell.show();
1758
1802
  });
1759
1803
 
1760
- if (this.table.options.persistentLayout && this.table.extExists("persistentLayout", true)) {
1804
+ if (this.table.options.persistentLayout && this.table.extExists("persistence", true)) {
1761
1805
 
1762
- this.table.extensions.persistentLayout.save();
1806
+ this.table.extensions.persistence.save("columns");
1763
1807
  }
1764
1808
 
1765
1809
  this.table.options.groupVisibilityChanged(this.getComponent(), true);
@@ -1792,9 +1836,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
1792
1836
  cell.hide();
1793
1837
  });
1794
1838
 
1795
- if (this.table.options.persistentLayout && this.table.extExists("persistentLayout", true)) {
1839
+ if (this.table.options.persistentLayout && this.table.extExists("persistence", true)) {
1796
1840
 
1797
- this.table.extensions.persistentLayout.save();
1841
+ this.table.extensions.persistence.save("columns");
1798
1842
  }
1799
1843
 
1800
1844
  this.table.options.groupVisibilityChanged(this.getComponent(), false);
@@ -1928,18 +1972,32 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
1928
1972
  return cell;
1929
1973
  };
1930
1974
 
1931
- Column.prototype.reinitializeWidth = function () {
1975
+ Column.prototype.reinitializeWidth = function (force) {
1932
1976
 
1933
1977
  this.widthFixed = false;
1934
1978
 
1935
1979
  //set width if present
1936
1980
 
1937
- if (typeof this.definition.width !== "undefined") {
1981
+ if (typeof this.definition.width !== "undefined" && !force) {
1938
1982
 
1939
1983
  this.setWidth(this.definition.width);
1940
1984
  }
1941
1985
 
1986
+ //hide header filters to prevent them altering column width
1987
+
1988
+ if (this.table.extExists("filter")) {
1989
+
1990
+ this.table.extensions.filter.hideHeaderFilterElements();
1991
+ }
1992
+
1942
1993
  this.fitToData();
1994
+
1995
+ //show header filters again after layout is complete
1996
+
1997
+ if (this.table.extExists("filter")) {
1998
+
1999
+ this.table.extensions.filter.showHeaderFilterElements();
2000
+ }
1943
2001
  };
1944
2002
 
1945
2003
  //set column width to maximum cell width
@@ -2087,6 +2145,19 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
2087
2145
  return this.tableElement;
2088
2146
  };
2089
2147
 
2148
+ //return position of row in table
2149
+
2150
+ RowManager.prototype.getRowPosition = function (row, active) {
2151
+
2152
+ if (active) {
2153
+
2154
+ return this.activeRows.indexOf(row);
2155
+ } else {
2156
+
2157
+ return this.rows.indexOf(row);
2158
+ }
2159
+ };
2160
+
2090
2161
  //link to column manager
2091
2162
 
2092
2163
  RowManager.prototype.setColumnManager = function (manager) {
@@ -2132,7 +2203,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
2132
2203
 
2133
2204
  //handle virtual dom scrolling
2134
2205
 
2135
- if (self.table.options.height && self.table.options.virtualDom) {
2206
+ if (self.table.options.virtualDom) {
2136
2207
 
2137
2208
  self.element.scroll(function () {
2138
2209
 
@@ -2203,6 +2274,17 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
2203
2274
  return false;
2204
2275
  };
2205
2276
 
2277
+ RowManager.prototype.getRowFromPosition = function (position, active) {
2278
+
2279
+ if (active) {
2280
+
2281
+ return this.activeRows[position];
2282
+ } else {
2283
+
2284
+ return this.rows[position];
2285
+ }
2286
+ };
2287
+
2206
2288
  RowManager.prototype.scrollToRow = function (row) {
2207
2289
 
2208
2290
  var rowIndex;
@@ -2241,6 +2323,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
2241
2323
 
2242
2324
  self.table.options.dataLoading(data);
2243
2325
 
2326
+ self.rows.forEach(function (row) {
2327
+
2328
+ row.wipe();
2329
+ });
2330
+
2244
2331
  self.rows = [];
2245
2332
 
2246
2333
  if (this.table.options.history && this.table.extExists("history")) {
@@ -2305,13 +2392,19 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
2305
2392
  this.refreshActiveData();
2306
2393
  } else {
2307
2394
 
2308
- this.renderTable();
2395
+ if (this.table.options.groupBy && this.table.extExists("groupRows")) {
2396
+
2397
+ this.table.extensions.groupRows.updateGroupRows(true);
2398
+ } else {
2399
+
2400
+ this.reRenderInPosition();
2401
+ }
2309
2402
  }
2310
2403
  };
2311
2404
 
2312
- RowManager.prototype.addRow = function (data, pos, index) {
2405
+ RowManager.prototype.addRow = function (data, pos, index, blockRedraw) {
2313
2406
 
2314
- var row = this.addRowActual(data, pos, index);
2407
+ var row = this.addRowActual(data, pos, index, blockRedraw);
2315
2408
 
2316
2409
  if (this.table.options.history && this.table.extExists("history")) {
2317
2410
 
@@ -2326,6 +2419,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
2326
2419
  RowManager.prototype.addRows = function (data, pos, index) {
2327
2420
 
2328
2421
  var self = this,
2422
+ length = 0,
2329
2423
  rows = [];
2330
2424
 
2331
2425
  pos = this.findAddRowPos(pos);
@@ -2335,18 +2429,35 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
2335
2429
  data = [data];
2336
2430
  }
2337
2431
 
2432
+ length = data.length - 1;
2433
+
2338
2434
  if (typeof index == "undefined" && pos || typeof index !== "undefined" && !pos) {
2339
2435
 
2340
2436
  data.reverse();
2341
2437
  }
2342
2438
 
2343
- data.forEach(function (item) {
2439
+ data.forEach(function (item, i) {
2344
2440
 
2345
- var row = self.addRow(item, pos, index);
2441
+ var row = self.addRow(item, pos, index, true);
2346
2442
 
2347
2443
  rows.push(row.getComponent());
2348
2444
  });
2349
2445
 
2446
+ if (this.table.options.groupBy && this.table.extExists("groupRows")) {
2447
+
2448
+ this.table.extensions.groupRows.updateGroupRows(true);
2449
+ } else {
2450
+
2451
+ this.reRenderInPosition();
2452
+ }
2453
+
2454
+ //recalc column calculations if present
2455
+
2456
+ if (this.table.extExists("columnCalcs")) {
2457
+
2458
+ this.table.extensions.columnCalcs.recalc(this.table.rowManager.displayRows);
2459
+ }
2460
+
2350
2461
  return rows;
2351
2462
  };
2352
2463
 
@@ -2370,10 +2481,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
2370
2481
  return pos;
2371
2482
  };
2372
2483
 
2373
- RowManager.prototype.addRowActual = function (data, pos, index) {
2484
+ RowManager.prototype.addRowActual = function (data, pos, index, blockRedraw) {
2374
2485
 
2375
- var safeData = data || {},
2376
- row = new Row(safeData, this),
2486
+ var row = new Row(data || {}, this),
2377
2487
  top = this.findAddRowPos(pos);
2378
2488
 
2379
2489
  if (index) {
@@ -2381,6 +2491,40 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
2381
2491
  index = this.findRow(index);
2382
2492
  }
2383
2493
 
2494
+ if (this.table.options.groupBy && this.table.extExists("groupRows")) {
2495
+
2496
+ this.table.extensions.groupRows.assignRowToGroup(row);
2497
+
2498
+ var groupRows = row.getGroup().rows;
2499
+
2500
+ if (groupRows.length > 1) {
2501
+
2502
+ if (!index || index && groupRows.indexOf(index) == -1) {
2503
+
2504
+ if (top) {
2505
+
2506
+ if (groupRows[0] !== row) {
2507
+
2508
+ index = groupRows[0];
2509
+
2510
+ this._moveRowInArray(row.getGroup().rows, row, index, top);
2511
+ }
2512
+ } else {
2513
+
2514
+ if (groupRows[groupRows.length - 1] !== row) {
2515
+
2516
+ index = groupRows[groupRows.length - 1];
2517
+
2518
+ this._moveRowInArray(row.getGroup().rows, row, index, top);
2519
+ }
2520
+ }
2521
+ } else {
2522
+
2523
+ this._moveRowInArray(row.getGroup().rows, row, index, top);
2524
+ }
2525
+ }
2526
+ };
2527
+
2384
2528
  if (index) {
2385
2529
 
2386
2530
  var allIndex = this.rows.indexOf(index),
@@ -2428,63 +2572,98 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
2428
2572
 
2429
2573
  this.table.options.dataEdited(this.getData());
2430
2574
 
2431
- this.renderTable();
2575
+ if (!blockRedraw) {
2576
+
2577
+ this.reRenderInPosition();
2578
+ }
2432
2579
 
2433
2580
  return row;
2434
2581
  };
2435
2582
 
2436
2583
  RowManager.prototype.moveRow = function (from, to, after) {
2437
2584
 
2585
+ if (this.table.options.history && this.table.extExists("history")) {
2586
+
2587
+ this.table.extensions.history.action("rowMoved", from, { pos: this.getRowPosition(from), to: to, after: after });
2588
+ };
2589
+
2590
+ this.moveRowActual(from, to, after);
2591
+
2592
+ this.table.options.rowMoved(from.getComponent());
2593
+ };
2594
+
2595
+ RowManager.prototype.moveRowActual = function (from, to, after) {
2596
+
2438
2597
  this._moveRowInArray(this.rows, from, to, after);
2439
2598
 
2440
2599
  this._moveRowInArray(this.activeRows, from, to, after);
2441
2600
 
2442
2601
  this._moveRowInArray(this.displayRows, from, to, after);
2443
2602
 
2444
- this.table.options.rowMoved(from.getComponent());
2603
+ if (this.table.options.groupBy && this.table.extExists("groupRows")) {
2604
+
2605
+ var toGroup = to.getGroup();
2606
+
2607
+ var fromGroup = from.getGroup();
2608
+
2609
+ if (toGroup === fromGroup) {
2610
+
2611
+ this._moveRowInArray(toGroup.rows, from, to, after);
2612
+ } else {
2613
+
2614
+ if (fromGroup) {
2615
+
2616
+ fromGroup.removeRow(from);
2617
+ }
2618
+
2619
+ toGroup.insertRow(from, to, after);
2620
+ }
2621
+ }
2445
2622
  };
2446
2623
 
2447
2624
  RowManager.prototype._moveRowInArray = function (rows, from, to, after) {
2448
2625
 
2449
- var fromIndex = rows.indexOf(from),
2450
- toIndex,
2451
- start,
2452
- end;
2626
+ var fromIndex, toIndex, start, end;
2453
2627
 
2454
- if (fromIndex > -1) {
2628
+ if (from !== to) {
2455
2629
 
2456
- rows.splice(fromIndex, 1);
2630
+ fromIndex = rows.indexOf(from);
2457
2631
 
2458
- toIndex = rows.indexOf(to);
2632
+ if (fromIndex > -1) {
2459
2633
 
2460
- if (toIndex > -1) {
2634
+ rows.splice(fromIndex, 1);
2461
2635
 
2462
- if (after) {
2636
+ toIndex = rows.indexOf(to);
2637
+
2638
+ if (toIndex > -1) {
2639
+
2640
+ if (after) {
2463
2641
 
2464
- rows.splice(toIndex + 1, 0, from);
2642
+ rows.splice(toIndex + 1, 0, from);
2643
+ } else {
2644
+
2645
+ rows.splice(toIndex, 0, from);
2646
+ }
2465
2647
  } else {
2466
2648
 
2467
- rows.splice(toIndex, 0, from);
2649
+ rows.splice(fromIndex, 0, from);
2468
2650
  }
2469
- } else {
2470
-
2471
- rows.splice(fromIndex, 0, from);
2472
2651
  }
2473
- }
2474
2652
 
2475
- //restyle rows
2653
+ //restyle rows
2476
2654
 
2477
- if (rows === this.displayRows) {
2655
+ if (rows === this.displayRows) {
2478
2656
 
2479
- start = fromIndex < toIndex ? fromIndex : toIndex;
2657
+ start = fromIndex < toIndex ? fromIndex : toIndex;
2480
2658
 
2481
- end = toIndex > fromIndex ? toIndex : fromIndex + 1;
2659
+ end = toIndex > fromIndex ? toIndex : fromIndex + 1;
2482
2660
 
2483
- for (var i = start; i <= end; i++) {
2661
+ for (var i = start; i <= end; i++) {
2484
2662
 
2485
- if (rows[i]) {
2663
+ if (rows[i]) {
2486
2664
 
2487
- this.styleRow(rows[i], i);
2665
+ this.styleRow(rows[i], i);
2666
+ }
2488
2667
  }
2489
2668
  }
2490
2669
  }
@@ -2579,7 +2758,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
2579
2758
 
2580
2759
  var def = column.getDefinition();
2581
2760
 
2582
- if (column.getVisibility()) {
2761
+ if (column.getVisibility() && !def.hideInHtml) {
2583
2762
 
2584
2763
  header += '<th>' + (def.title || "") + '</th>';
2585
2764
  }
@@ -2812,6 +2991,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
2812
2991
  if (self.element.is(":visible")) {
2813
2992
 
2814
2993
  self.renderTable();
2994
+
2995
+ if (table.options.layoutColumnsOnNewData) {
2996
+
2997
+ self.table.columnManager.redraw(true);
2998
+ }
2815
2999
  }
2816
3000
 
2817
3001
  if (table.extExists("columnCalcs")) {
@@ -2831,6 +3015,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
2831
3015
 
2832
3016
  this.displayRows = displayRows;
2833
3017
 
3018
+ if (this.table.extExists("frozenRows")) {
3019
+
3020
+ this.table.extensions.frozenRows.filterFrozenRows();
3021
+ }
3022
+
2834
3023
  this.displayRowsCount = this.displayRows.length;
2835
3024
  };
2836
3025
 
@@ -2844,6 +3033,40 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
2844
3033
  ///////////////// Table Rendering /////////////////
2845
3034
 
2846
3035
 
3036
+ //trigger rerender of table in current position
3037
+
3038
+ RowManager.prototype.reRenderInPosition = function (rowCount) {
3039
+
3040
+ if (this.getRenderMode() == "virtual") {
3041
+
3042
+ var scrollTop = this.element.scrollTop();
3043
+
3044
+ var topRow = false;
3045
+
3046
+ var topOffset = false;
3047
+
3048
+ for (var i = this.vDomTop; i <= this.vDomBottom; i++) {
3049
+
3050
+ if (this.displayRows[i]) {
3051
+
3052
+ var diff = scrollTop - this.displayRows[i].getElement().position().top;
3053
+
3054
+ if (topOffset === false || Math.abs(diff) < topOffset) {
3055
+
3056
+ topOffset = diff;
3057
+
3058
+ topRow = i;
3059
+ }
3060
+ }
3061
+ }
3062
+
3063
+ this._virtualRenderFill(topRow === false ? this.displayRows.length - 1 : topRow, true, topOffset || 0);
3064
+ } else {
3065
+
3066
+ this.renderTable();
3067
+ }
3068
+ };
3069
+
2847
3070
  RowManager.prototype.renderTable = function () {
2848
3071
 
2849
3072
  var self = this;
@@ -2991,7 +3214,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
2991
3214
 
2992
3215
  //full virtual render
2993
3216
 
2994
- RowManager.prototype._virtualRenderFill = function (position, forceMove) {
3217
+ RowManager.prototype._virtualRenderFill = function (position, forceMove, offset) {
2995
3218
 
2996
3219
  var self = this,
2997
3220
  element = self.tableElement,
@@ -3083,7 +3306,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
3083
3306
  self.vDomScrollHeight = topPadHeight + rowsHeight + self.vDomBottomPad - self.height;
3084
3307
  } else {
3085
3308
 
3086
- self.vDomTopPad = !forceMove ? self.scrollTop - topPadHeight : self.vDomRowHeight * this.vDomTop + topPadHeight;
3309
+ self.vDomTopPad = !forceMove ? self.scrollTop - topPadHeight : self.vDomRowHeight * this.vDomTop + offset;
3087
3310
 
3088
3311
  self.vDomBottomPad = self.vDomBottom == self.displayRowsCount - 1 ? 0 : Math.max(self.vDomScrollHeight - self.vDomTopPad - rowsHeight - topPadHeight, 0);
3089
3312
  }
@@ -3094,7 +3317,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
3094
3317
 
3095
3318
  if (forceMove) {
3096
3319
 
3097
- this.scrollTop = self.vDomTopPad + topPadHeight;
3320
+ this.scrollTop = self.vDomTopPad + topPadHeight + offset;
3098
3321
  }
3099
3322
 
3100
3323
  this.scrollTop = Math.min(this.scrollTop, this.element[0].scrollHeight - this.height);
@@ -3222,7 +3445,12 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
3222
3445
 
3223
3446
  if (this.vDomTopPad < 0) {
3224
3447
 
3225
- this.vDomTopPad = (this.vDomTop - 1) * this.vDomRowHeight;
3448
+ this.vDomTopPad = index * this.vDomRowHeight;
3449
+ }
3450
+
3451
+ if (!index) {
3452
+
3453
+ this.vDomTopPad = 0;
3226
3454
  }
3227
3455
 
3228
3456
  table[0].style.paddingTop = this.vDomTopPad + "px";
@@ -3388,24 +3616,21 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
3388
3616
 
3389
3617
  var self = this;
3390
3618
 
3391
- if (self.table.options.height) {
3392
-
3393
- var otherHeigt = self.columnManager.getElement().outerHeight() + (self.table.footerManager ? self.table.footerManager.getElement().outerHeight() : 0);
3619
+ var otherHeight = self.columnManager.getElement().outerHeight() + (self.table.footerManager ? self.table.footerManager.getElement().outerHeight() : 0);
3394
3620
 
3395
- self.element.css({
3621
+ self.element.css({
3396
3622
 
3397
- "min-height": "calc(100% - " + otherHeigt + "px)",
3623
+ "min-height": "calc(100% - " + otherHeight + "px)",
3398
3624
 
3399
- "height": "calc(100% - " + otherHeigt + "px)",
3625
+ "height": "calc(100% - " + otherHeight + "px)",
3400
3626
 
3401
- "max-height": "calc(100% - " + otherHeigt + "px)"
3627
+ "max-height": "calc(100% - " + otherHeight + "px)"
3402
3628
 
3403
- });
3629
+ });
3404
3630
 
3405
- self.height = self.element.innerHeight();
3631
+ self.height = self.element.innerHeight();
3406
3632
 
3407
- self.vDomWindowBuffer = self.table.options.virtualDomBuffer || self.height;
3408
- }
3633
+ self.vDomWindowBuffer = self.table.options.virtualDomBuffer || self.height;
3409
3634
  };
3410
3635
 
3411
3636
  //renitialize all rows
@@ -3422,7 +3647,8 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
3422
3647
 
3423
3648
  RowManager.prototype.redraw = function (force) {
3424
3649
 
3425
- var pos = 0;
3650
+ var pos = 0,
3651
+ left = this.scrollLeft;
3426
3652
 
3427
3653
  if (this.renderMode == "virtual") {
3428
3654
 
@@ -3439,6 +3665,8 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
3439
3665
  var pos = Math.floor(this.element.scrollTop() / this.element[0].scrollHeight * this.displayRowsCount);
3440
3666
 
3441
3667
  this._virtualRenderFill(pos);
3668
+
3669
+ this.scrollHorizontal(left);
3442
3670
  }
3443
3671
 
3444
3672
  if (!this.displayRowsCount) {
@@ -3502,6 +3730,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
3502
3730
  return this.row.getData(true)[this.row.table.options.index];
3503
3731
  };
3504
3732
 
3733
+ RowComponent.prototype.getPosition = function (active) {
3734
+
3735
+ return this.row.table.rowManager.getRowPosition(this.row, active);
3736
+ };
3737
+
3505
3738
  RowComponent.prototype.delete = function () {
3506
3739
 
3507
3740
  this.row.delete();
@@ -3542,6 +3775,32 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
3542
3775
  return this.row;
3543
3776
  };
3544
3777
 
3778
+ RowComponent.prototype.freeze = function () {
3779
+
3780
+ if (this.row.table.extExists("frozenRows", true)) {
3781
+
3782
+ this.row.table.extensions.frozenRows.freezeRow(this.row);
3783
+ }
3784
+ };
3785
+
3786
+ RowComponent.prototype.unfreeze = function () {
3787
+
3788
+ if (this.row.table.extExists("frozenRows", true)) {
3789
+
3790
+ this.row.table.extensions.frozenRows.unfreezeRow(this.row);
3791
+ }
3792
+ };
3793
+
3794
+ RowComponent.prototype.reformat = function () {
3795
+
3796
+ return this.row.reinitialize();
3797
+ };
3798
+
3799
+ RowComponent.prototype.getGroup = function () {
3800
+
3801
+ return this.row.getGroup().getComponent();
3802
+ };
3803
+
3545
3804
  var Row = function Row(data, parent) {
3546
3805
 
3547
3806
  this.table = parent.table;
@@ -3739,6 +3998,13 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
3739
3998
  self.table.options.rowFormatter(self.getComponent());
3740
3999
  }
3741
4000
 
4001
+ //set resizable handles
4002
+
4003
+ if (self.table.options.resizableRows && self.table.extExists("resizeRows")) {
4004
+
4005
+ self.table.extensions.resizeRows.initializeRow(self);
4006
+ }
4007
+
3742
4008
  self.initialized = true;
3743
4009
  }
3744
4010
  };
@@ -3812,6 +4078,13 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
3812
4078
  this.setCellHeight();
3813
4079
  };
3814
4080
 
4081
+ Row.prototype.setHeight = function (height) {
4082
+
4083
+ this.height = height;
4084
+
4085
+ this.setCellHeight();
4086
+ };
4087
+
3815
4088
  //set height of rows
3816
4089
 
3817
4090
  Row.prototype.setHeight = function (height, force) {
@@ -3877,6 +4150,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
3877
4150
 
3878
4151
  var self = this;
3879
4152
 
4153
+ if (typeof data === "string") {
4154
+
4155
+ data = JSON.parse(data);
4156
+ }
4157
+
3880
4158
  //mutate incomming data if needed
3881
4159
 
3882
4160
  if (self.table.extExists("mutator")) {
@@ -4033,6 +4311,13 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
4033
4311
 
4034
4312
  var index = this.table.rowManager.getRowIndex(this);
4035
4313
 
4314
+ //deselect row if it is selected
4315
+
4316
+ if (this.table.extExists("selectRow")) {
4317
+
4318
+ this.table.extensions.selectRow._deselectRow(this.row, true);
4319
+ }
4320
+
4036
4321
  this.deleteActual();
4037
4322
 
4038
4323
  if (this.table.options.history && this.table.extExists("history")) {
@@ -4044,6 +4329,26 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
4044
4329
 
4045
4330
  this.table.extensions.history.action("rowDelete", this, { data: this.getData(), pos: !index, index: index });
4046
4331
  };
4332
+
4333
+ //remove from group
4334
+
4335
+ if (this.extensions.group) {
4336
+
4337
+ this.extensions.group.removeRow(this);
4338
+ }
4339
+
4340
+ //recalc column calculations if present
4341
+
4342
+ if (this.table.extExists("columnCalcs")) {
4343
+
4344
+ if (this.table.options.groupBy && this.table.extExists("groupRows")) {
4345
+
4346
+ this.table.extensions.columnCalcs.recalcRowGroup(this);
4347
+ } else {
4348
+
4349
+ this.table.extensions.columnCalcs.recalc(this.table.rowManager.displayRows);
4350
+ }
4351
+ }
4047
4352
  };
4048
4353
 
4049
4354
  Row.prototype.deleteActual = function () {
@@ -4063,6 +4368,20 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
4063
4368
  }
4064
4369
  };
4065
4370
 
4371
+ Row.prototype.wipe = function () {
4372
+
4373
+ this.deleteCells();
4374
+
4375
+ this.element.empty();
4376
+
4377
+ this.element.remove();
4378
+ };
4379
+
4380
+ Row.prototype.getGroup = function () {
4381
+
4382
+ return this.extensions.group || false;
4383
+ };
4384
+
4066
4385
  //////////////// Object Generation /////////////////
4067
4386
 
4068
4387
  Row.prototype.getComponent = function () {
@@ -4127,9 +4446,14 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
4127
4446
  this.cell.setValueActual(this.cell.getOldValue());
4128
4447
  };
4129
4448
 
4130
- CellComponent.prototype.edit = function () {
4449
+ CellComponent.prototype.edit = function (force) {
4450
+
4451
+ return this.cell.edit(force);
4452
+ };
4453
+
4454
+ CellComponent.prototype.cancelEdit = function () {
4131
4455
 
4132
- this.cell.edit();
4456
+ this.cell.cancelEdit(force);
4133
4457
  };
4134
4458
 
4135
4459
  CellComponent.prototype.nav = function () {
@@ -4402,7 +4726,8 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
4402
4726
 
4403
4727
  Cell.prototype.setValue = function (value, mutate) {
4404
4728
 
4405
- var changed = this.setValueProcessData(value, mutate);
4729
+ var changed = this.setValueProcessData(value, mutate),
4730
+ component;
4406
4731
 
4407
4732
  if (changed) {
4408
4733
 
@@ -4411,7 +4736,14 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
4411
4736
  this.table.extensions.history.action("cellEdit", this, { oldValue: this.oldValue, newValue: this.value });
4412
4737
  };
4413
4738
 
4414
- this.table.options.cellEdited(this.getComponent());
4739
+ component = this.getComponent();
4740
+
4741
+ if (this.column.cellEvents.cellEdited) {
4742
+
4743
+ this.column.cellEvents.cellEdited(component);
4744
+ }
4745
+
4746
+ this.table.options.cellEdited(component);
4415
4747
 
4416
4748
  this.table.options.dataEdited(this.table.rowManager.getData());
4417
4749
  }
@@ -4535,9 +4867,28 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
4535
4867
  this.element[0].style.display = "none";
4536
4868
  };
4537
4869
 
4538
- Cell.prototype.edit = function () {
4870
+ Cell.prototype.edit = function (force) {
4871
+
4872
+ if (this.table.extExists("edit", true)) {
4873
+
4874
+ return this.table.extensions.edit.edit(this, false, force);
4875
+ }
4876
+ };
4877
+
4878
+ Cell.prototype.cancelEdit = function () {
4879
+
4880
+ if (this.table.extExists("edit", true)) {
4881
+
4882
+ var editing = this.table.extensions.edit.getCurrentCell();
4539
4883
 
4540
- this.element.focus();
4884
+ if (editing && editing._getSelf() === this) {
4885
+
4886
+ this.table.extensions.edit.cancelEdit();
4887
+ } else {
4888
+
4889
+ console.warn("Cancel Editor Error - This cell is not currently being edited ");
4890
+ }
4891
+ }
4541
4892
  };
4542
4893
 
4543
4894
  Cell.prototype.delete = function () {
@@ -4791,6 +5142,8 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
4791
5142
 
4792
5143
  layout: "fitData", ///layout type "fitColumns" | "fitData"
4793
5144
 
5145
+ layoutColumnsOnNewData: false, //update column widths on setData
5146
+
4794
5147
  fitColumns: false, //DEPRICATED - fit colums to width of screen;
4795
5148
 
4796
5149
 
@@ -4801,6 +5154,10 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
4801
5154
 
4802
5155
  resizableColumns: true, //resizable columns
4803
5156
 
5157
+ resizableRows: true, //resizable rows
5158
+
5159
+ autoResize: true, //auto resize table
5160
+
4804
5161
 
4805
5162
  columns: [], //store for colum header info
4806
5163
 
@@ -4855,9 +5212,17 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
4855
5212
  virtualDom: true, //enable DOM virtualization
4856
5213
 
4857
5214
 
4858
- persistentLayout: false, //store cookie with column _styles
5215
+ persistentLayout: false, //store column layout in memory
4859
5216
 
4860
- persistentLayoutID: "", //id for stored cookie
5217
+ persistentSort: false, //store sorting in memory
5218
+
5219
+ persistentFilter: false, //store filters in memory
5220
+
5221
+ persistenceID: "", //key for persistent storage
5222
+
5223
+ persistenceMode: true, //mode for storing persistence information
5224
+
5225
+ persistentLayoutID: "", //DEPRICATED - key for persistent storage;
4861
5226
 
4862
5227
 
4863
5228
  responsiveLayout: false, //responsive layout flags
@@ -4949,6 +5314,8 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
4949
5314
 
4950
5315
  rowDeselected: function rowDeselected() {},
4951
5316
 
5317
+ rowResized: function rowResized() {},
5318
+
4952
5319
  //cell callbacks
4953
5320
 
4954
5321
  cellEditing: function cellEditing() {},
@@ -5035,7 +5402,13 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
5035
5402
 
5036
5403
  //validation has failed
5037
5404
 
5038
- validationFailed: function validationFailed() {}
5405
+ validationFailed: function validationFailed() {},
5406
+
5407
+ //history callbacks
5408
+
5409
+ historyUndo: function historyUndo() {},
5410
+
5411
+ historyRedo: function historyRedo() {}
5039
5412
 
5040
5413
  },
5041
5414
 
@@ -5049,6 +5422,22 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
5049
5422
 
5050
5423
  console.warn("The%c fitColumns:true%c option has been depricated and will be removed in version 4.0, use %c layout:'fitColumns'%c instead.", "font-weight:bold;", "font-weight:regular;", "font-weight:bold;", "font-weight:regular;");
5051
5424
  }
5425
+
5426
+ if (this.options.persistentLayoutID) {
5427
+
5428
+ this.options.persistenceID = this.options.persistentLayoutID;
5429
+
5430
+ console.warn("The%c persistentLayoutID%c option has been depricated and will be removed in version 4.0, use %c persistenceID%c instead.", "font-weight:bold;", "font-weight:regular;", "font-weight:bold;", "font-weight:regular;");
5431
+ }
5432
+
5433
+ if (this.options.persistentLayout === "cookie" || this.options.persistentLayout === "local") {
5434
+
5435
+ this.options.persistenceMode = this.options.persistentLayout;
5436
+
5437
+ this.options.persistentLayout = true;
5438
+
5439
+ console.warn("Setting the persistent storage mode on the%c persistentLayout%c option has been depricated and will be removed in version 4.0, use %c persistenceMode%c instead.", "font-weight:bold;", "font-weight:regular;", "font-weight:bold;", "font-weight:regular;");
5440
+ }
5052
5441
  },
5053
5442
 
5054
5443
  //constructor
@@ -5167,11 +5556,14 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
5167
5556
  this.footerManager.activate();
5168
5557
  }
5169
5558
 
5170
- if (options.persistentLayout && this.extExists("persistentLayout", true)) {
5559
+ if ((options.persistentLayout || options.persistentSort || options.persistentFilter) && this.extExists("persistence", true)) {
5560
+
5561
+ ext.persistence.initialize(options.persistenceMode, options.persistenceID);
5562
+ }
5171
5563
 
5172
- ext.persistentLayout.initialize(options.persistentLayout, options.persistentLayoutID);
5564
+ if (options.persistentLayout && this.extExists("persistence", true)) {
5173
5565
 
5174
- options.columns = ext.persistentLayout.load(options.columns);
5566
+ options.columns = ext.persistence.load("columns", options.columns);
5175
5567
  }
5176
5568
 
5177
5569
  if (this.extExists("columnCalcs")) {
@@ -5181,9 +5573,39 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
5181
5573
 
5182
5574
  this.columnManager.setColumns(options.columns);
5183
5575
 
5184
- if (options.initialSort && this.extExists("sort", true)) {
5576
+ if (this.extExists("frozenRows")) {
5577
+
5578
+ this.extensions.frozenRows.initialize();
5579
+ }
5580
+
5581
+ if ((options.persistentSort || options.initialSort) && this.extExists("sort", true)) {
5582
+
5583
+ var sorters = [];
5584
+
5585
+ if (options.persistentSort && this.extExists("persistence", true)) {
5185
5586
 
5186
- ext.sort.setSort(options.initialSort);
5587
+ sorters = ext.persistence.load("sort");
5588
+
5589
+ if (sorters === false && options.initialSort) {
5590
+
5591
+ sorters = options.initialSort;
5592
+ }
5593
+ } else if (options.initialSort) {
5594
+
5595
+ sorters = options.initialSort;
5596
+ }
5597
+
5598
+ ext.sort.setSort(sorters);
5599
+ }
5600
+
5601
+ if (options.persistentFilter && this.extExists("persistence", true)) {
5602
+
5603
+ var filters = ext.persistence.load("filter");
5604
+
5605
+ if (filters !== false) {
5606
+
5607
+ this.setFilter(filters);
5608
+ }
5187
5609
  }
5188
5610
 
5189
5611
  if (options.pagination && this.extExists("page", true)) {
@@ -5211,6 +5633,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
5211
5633
  ext.selectRow.clearSelectionData();
5212
5634
  }
5213
5635
 
5636
+ if (options.autoResize && this.extExists("resizeTable")) {
5637
+
5638
+ ext.resizeTable.initialize();
5639
+ }
5640
+
5214
5641
  options.tableBuilt();
5215
5642
  },
5216
5643
 
@@ -5419,6 +5846,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
5419
5846
 
5420
5847
  var self = this;
5421
5848
 
5849
+ if (typeof data === "string") {
5850
+
5851
+ data = JSON.parse(data);
5852
+ }
5853
+
5422
5854
  if (data) {
5423
5855
 
5424
5856
  data.forEach(function (item) {
@@ -5438,6 +5870,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
5438
5870
 
5439
5871
  addData: function addData(data, pos, index) {
5440
5872
 
5873
+ if (typeof data === "string") {
5874
+
5875
+ data = JSON.parse(data);
5876
+ }
5877
+
5441
5878
  if (data) {
5442
5879
 
5443
5880
  this.rowManager.addRows(data, pos, index);
@@ -5453,6 +5890,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
5453
5890
 
5454
5891
  var self = this;
5455
5892
 
5893
+ if (typeof data === "string") {
5894
+
5895
+ data = JSON.parse(data);
5896
+ }
5897
+
5456
5898
  if (data) {
5457
5899
 
5458
5900
  data.forEach(function (item) {
@@ -5464,7 +5906,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
5464
5906
  row.updateData(item);
5465
5907
  } else {
5466
5908
 
5467
- self.rowManager.addRow(item);
5909
+ self.rowManager.addRows(item);
5468
5910
  }
5469
5911
  });
5470
5912
  } else {
@@ -5490,6 +5932,23 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
5490
5932
  }
5491
5933
  },
5492
5934
 
5935
+ //get row object
5936
+
5937
+ getRowFromPosition: function getRowFromPosition(position, active) {
5938
+
5939
+ var row = this.rowManager.getRowFromPosition(position, active);
5940
+
5941
+ if (row) {
5942
+
5943
+ return row.getComponent();
5944
+ } else {
5945
+
5946
+ console.warn("Find Error - No matching row found:", position);
5947
+
5948
+ return false;
5949
+ }
5950
+ },
5951
+
5493
5952
  //delete row from table
5494
5953
 
5495
5954
  deleteRow: function deleteRow(index) {
@@ -5513,7 +5972,23 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
5513
5972
 
5514
5973
  addRow: function addRow(data, pos, index) {
5515
5974
 
5516
- return this.rowManager.addRow(data, pos, index);
5975
+ var row;
5976
+
5977
+ if (typeof data === "string") {
5978
+
5979
+ data = JSON.parse(data);
5980
+ }
5981
+
5982
+ row = this.rowManager.addRows(data, pos, index)[0];
5983
+
5984
+ //recalc column calculations if present
5985
+
5986
+ if (this.extExists("columnCalcs")) {
5987
+
5988
+ this.extensions.columnCalcs.recalc(this.rowManager.displayRows);
5989
+ }
5990
+
5991
+ return row;
5517
5992
  },
5518
5993
 
5519
5994
  //update a row if it exitsts otherwise create it
@@ -5522,12 +5997,24 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
5522
5997
 
5523
5998
  var row = this.rowManager.findRow(index);
5524
5999
 
6000
+ if (typeof data === "string") {
6001
+
6002
+ data = JSON.parse(data);
6003
+ }
6004
+
5525
6005
  if (row) {
5526
6006
 
5527
6007
  row.updateData(data);
5528
6008
  } else {
5529
6009
 
5530
- row = this.rowManager.addRow(data);
6010
+ row = this.rowManager.addRows(data)[0];
6011
+
6012
+ //recalc column calculations if present
6013
+
6014
+ if (this.extExists("columnCalcs")) {
6015
+
6016
+ this.extensions.columnCalcs.recalc(this.rowManager.displayRows);
6017
+ }
5531
6018
  }
5532
6019
 
5533
6020
  return row.getComponent();
@@ -5539,6 +6026,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
5539
6026
 
5540
6027
  var row = this.rowManager.findRow(index);
5541
6028
 
6029
+ if (typeof data === "string") {
6030
+
6031
+ data = JSON.parse(data);
6032
+ }
6033
+
5542
6034
  if (row) {
5543
6035
 
5544
6036
  row.updateData(data);
@@ -5574,6 +6066,23 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
5574
6066
  return this.rowManager.getComponents(active);
5575
6067
  },
5576
6068
 
6069
+ //get position of row in table
6070
+
6071
+ getRowPosition: function getRowPosition(index, active) {
6072
+
6073
+ var row = this.rowManager.findRow(index);
6074
+
6075
+ if (row) {
6076
+
6077
+ return this.rowManager.getRowPosition(row, active);
6078
+ } else {
6079
+
6080
+ console.warn("Position Error - No matching row found:", index);
6081
+
6082
+ return false;
6083
+ }
6084
+ },
6085
+
5577
6086
  /////////////// Column Functions ///////////////
5578
6087
 
5579
6088
 
@@ -5594,17 +6103,17 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
5594
6103
 
5595
6104
  getColumnLayout: function getColumnLayout() {
5596
6105
 
5597
- if (this.extExists("persistentLayout", true)) {
6106
+ if (this.extExists("persistence", true)) {
5598
6107
 
5599
- return this.extensions.persistentLayout.parseColumns(this.columnManager.getColumns());
6108
+ return this.extensions.persistence.parseColumns(this.columnManager.getColumns());
5600
6109
  }
5601
6110
  },
5602
6111
 
5603
6112
  setColumnLayout: function setColumnLayout(layout) {
5604
6113
 
5605
- if (this.extExists("persistentLayout", true)) {
6114
+ if (this.extExists("persistence", true)) {
5606
6115
 
5607
- this.columnManager.setColumns(this.extensions.persistentLayout.mergeDefinition(this.options.columns, layout));
6116
+ this.columnManager.setColumns(this.extensions.persistence.mergeDefinition(this.options.columns, layout));
5608
6117
 
5609
6118
  return true;
5610
6119
  }
@@ -5685,6 +6194,23 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
5685
6194
  }
5686
6195
  },
5687
6196
 
6197
+ //scroll to column in DOM
6198
+
6199
+ scrollToColumn: function scrollToColumn(field) {
6200
+
6201
+ var column = this.columnManager.findColumn(field);
6202
+
6203
+ if (column) {
6204
+
6205
+ return this.columnManager.scrollToColumn(column);
6206
+ } else {
6207
+
6208
+ console.warn("Scroll Error - No matching column found:", field);
6209
+
6210
+ return false;
6211
+ }
6212
+ },
6213
+
5688
6214
  //////////// Localization Functions ////////////
5689
6215
 
5690
6216
  setLocale: function setLocale(locale) {
@@ -5810,6 +6336,42 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
5810
6336
  }
5811
6337
  },
5812
6338
 
6339
+ setHeaderFilterFocus: function setHeaderFilterFocus(field) {
6340
+
6341
+ if (this.extExists("filter", true)) {
6342
+
6343
+ var column = this.columnManager.findColumn(field);
6344
+
6345
+ if (column) {
6346
+
6347
+ this.extensions.filter.setHeaderFilterFocus(column);
6348
+ } else {
6349
+
6350
+ console.warn("Column Filter Focus Error - No matching column found:", field);
6351
+
6352
+ return false;
6353
+ }
6354
+ }
6355
+ },
6356
+
6357
+ setHeaderFilterValue: function setHeaderFilterValue(field, value) {
6358
+
6359
+ if (this.extExists("filter", true)) {
6360
+
6361
+ var column = this.columnManager.findColumn(field);
6362
+
6363
+ if (column) {
6364
+
6365
+ this.extensions.filter.setHeaderFilterValue(column, value);
6366
+ } else {
6367
+
6368
+ console.warn("Column Filter Error - No matching column found:", field);
6369
+
6370
+ return false;
6371
+ }
6372
+ }
6373
+ },
6374
+
5813
6375
  getHeaderFilters: function getHeaderFilters() {
5814
6376
 
5815
6377
  if (this.extExists("filter", true)) {
@@ -6057,6 +6619,19 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
6057
6619
  }
6058
6620
  },
6059
6621
 
6622
+ ///////////////// Column Calculation Functions ///////////////
6623
+
6624
+ getCalcResults: function getCalcResults() {
6625
+
6626
+ if (this.extExists("columnCalcs", true)) {
6627
+
6628
+ return this.extensions.columnCalcs.getResults();
6629
+ } else {
6630
+
6631
+ return false;
6632
+ }
6633
+ },
6634
+
6060
6635
  /////////////// Navigation Management //////////////
6061
6636
 
6062
6637
 
@@ -7080,19 +7655,24 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
7080
7655
 
7081
7656
  Ajax.prototype.showLoader = function () {
7082
7657
 
7083
- this.loaderElement.detach();
7658
+ var shouldLoad = typeof this.table.options.ajaxLoader === "function" ? this.table.options.ajaxLoader() : this.table.options.ajaxLoader;
7084
7659
 
7085
- this.msgElement.empty().removeClass("tabulator-error").addClass("tabulator-loading");
7660
+ if (shouldLoad) {
7086
7661
 
7087
- if (this.loadingElement) {
7662
+ this.loaderElement.detach();
7088
7663
 
7089
- this.msgElement.append(this.loadingElement);
7090
- } else {
7664
+ this.msgElement.empty().removeClass("tabulator-error").addClass("tabulator-loading");
7091
7665
 
7092
- this.msgElement.append(this.table.extensions.localize.getText("ajax.loading"));
7093
- }
7666
+ if (this.loadingElement) {
7094
7667
 
7095
- this.table.element.append(this.loaderElement);
7668
+ this.msgElement.append(this.loadingElement);
7669
+ } else {
7670
+
7671
+ this.msgElement.append(this.table.extensions.localize.getText("ajax.loading"));
7672
+ }
7673
+
7674
+ this.table.element.append(this.loaderElement);
7675
+ }
7096
7676
  };
7097
7677
 
7098
7678
  Ajax.prototype.showError = function () {
@@ -7294,7 +7874,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
7294
7874
 
7295
7875
  if (!this.topInitialized) {
7296
7876
 
7297
- this.table.columnManager.element.append(this.topElement);
7877
+ this.table.columnManager.headersElement.after(this.topElement);
7298
7878
 
7299
7879
  this.topInitialized = true;
7300
7880
  }
@@ -7369,26 +7949,35 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
7369
7949
 
7370
7950
  ColumnCalcs.prototype.recalcRowGroup = function (row) {
7371
7951
 
7952
+ this.recalcGroup(this.table.extensions.groupRows.getRowGroup(row));
7953
+ };
7954
+
7955
+ ColumnCalcs.prototype.recalcGroup = function (group) {
7956
+
7372
7957
  var data, rowData;
7373
7958
 
7374
- var group = this.table.extensions.groupRows.getRowGroup(row);
7959
+ if (group) {
7375
7960
 
7376
- if (group.calcs.bottom) {
7961
+ if (group.calcs) {
7377
7962
 
7378
- data = this.rowsToData(group.rows);
7963
+ if (group.calcs.bottom) {
7379
7964
 
7380
- rowData = this.generateRowData("bottom", data);
7965
+ data = this.rowsToData(group.rows);
7381
7966
 
7382
- group.calcs.bottom.updateData(rowData);
7383
- }
7967
+ rowData = this.generateRowData("bottom", data);
7384
7968
 
7385
- if (group.calcs.top) {
7969
+ group.calcs.bottom.updateData(rowData);
7970
+ }
7971
+
7972
+ if (group.calcs.top) {
7386
7973
 
7387
- data = this.rowsToData(group.rows);
7974
+ data = this.rowsToData(group.rows);
7388
7975
 
7389
- rowData = this.generateRowData("top", data);
7976
+ rowData = this.generateRowData("top", data);
7390
7977
 
7391
- group.calcs.top.updateData(rowData);
7978
+ group.calcs.top.updateData(rowData);
7979
+ }
7980
+ }
7392
7981
  }
7393
7982
  };
7394
7983
 
@@ -7540,6 +8129,66 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
7540
8129
  }
7541
8130
  };
7542
8131
 
8132
+ //return the calculated
8133
+
8134
+
8135
+ ColumnCalcs.prototype.getResults = function () {
8136
+
8137
+ var self = this,
8138
+ results = {},
8139
+ groups;
8140
+
8141
+ if (this.table.options.groupBy && this.table.extExists("groupRows")) {
8142
+
8143
+ groups = this.table.extensions.groupRows.getGroups();
8144
+
8145
+ groups.forEach(function (group) {
8146
+
8147
+ results[group.getKey()] = self.getGroupResults(group);
8148
+ });
8149
+ } else {
8150
+
8151
+ results = {
8152
+
8153
+ top: this.topRow ? this.topRow.getData() : {},
8154
+
8155
+ bottom: this.botRow ? this.botRow.getData() : {}
8156
+
8157
+ };
8158
+ }
8159
+
8160
+ return results;
8161
+ };
8162
+
8163
+ //get results from a group
8164
+
8165
+
8166
+ ColumnCalcs.prototype.getGroupResults = function (group) {
8167
+
8168
+ var self = this,
8169
+ groupObj = group._getSelf(),
8170
+ subGroups = group.getSubGroups(),
8171
+ subGroupResults = {},
8172
+ results = {};
8173
+
8174
+ subGroups.forEach(function (subgroup) {
8175
+
8176
+ subGroupResults[subgroup.getKey()] = self.getGroupResults(subgroup);
8177
+ });
8178
+
8179
+ results = {
8180
+
8181
+ top: groupObj.calcs.top ? groupObj.calcs.top.getData() : {},
8182
+
8183
+ bottom: groupObj.calcs.bottom ? groupObj.calcs.bottom.getData() : {},
8184
+
8185
+ groups: subGroupResults
8186
+
8187
+ };
8188
+
8189
+ return results;
8190
+ };
8191
+
7543
8192
  //default calculations
7544
8193
 
7545
8194
 
@@ -7569,7 +8218,8 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
7569
8218
 
7570
8219
  "max": function max(values, data, calcParams) {
7571
8220
 
7572
- var output = null;
8221
+ var output = null,
8222
+ precision = typeof calcParams.precision !== "undefined" ? calcParams.precision : false;
7573
8223
 
7574
8224
  values.forEach(function (value) {
7575
8225
 
@@ -7581,12 +8231,13 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
7581
8231
  }
7582
8232
  });
7583
8233
 
7584
- return output !== null ? output : "";
8234
+ return output !== null ? precision !== false ? output.toFixed(precision) : output : "";
7585
8235
  },
7586
8236
 
7587
8237
  "min": function min(values, data, calcParams) {
7588
8238
 
7589
- var output = null;
8239
+ var output = null,
8240
+ precision = typeof calcParams.precision !== "undefined" ? calcParams.precision : false;
7590
8241
 
7591
8242
  values.forEach(function (value) {
7592
8243
 
@@ -7598,12 +8249,13 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
7598
8249
  }
7599
8250
  });
7600
8251
 
7601
- return output !== null ? output : "";
8252
+ return output !== null ? precision !== false ? output.toFixed(precision) : output : "";
7602
8253
  },
7603
8254
 
7604
8255
  "sum": function sum(values, data, calcParams) {
7605
8256
 
7606
- var output = 0;
8257
+ var output = 0,
8258
+ precision = typeof calcParams.precision !== "undefined" ? calcParams.precision : false;
7607
8259
 
7608
8260
  if (values.length) {
7609
8261
 
@@ -7615,7 +8267,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
7615
8267
  });
7616
8268
  }
7617
8269
 
7618
- return output;
8270
+ return precision !== false ? output.toFixed(precision) : output;
7619
8271
  },
7620
8272
 
7621
8273
  "concat": function concat(values, data, calcParams) {
@@ -8017,6 +8669,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
8017
8669
 
8018
8670
  this.currentCell = false; //hold currently editing cell
8019
8671
 
8672
+
8673
+ this.mouseClick = false; //hold mousedown state to prevent click binding being overriden by editor opening
8674
+
8020
8675
  };
8021
8676
 
8022
8677
  //initialize column editor
@@ -8094,7 +8749,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
8094
8749
  return this.currentCell ? this.currentCell.getComponent() : false;
8095
8750
  };
8096
8751
 
8097
- Edit.prototype.clearEditor = function (cell) {
8752
+ Edit.prototype.clearEditor = function () {
8753
+
8754
+ var cell = this.currentCell;
8098
8755
 
8099
8756
  this.currentCell = false;
8100
8757
 
@@ -8105,15 +8762,64 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
8105
8762
  cell.row.getElement().removeClass("tabulator-row-editing");
8106
8763
  };
8107
8764
 
8765
+ Edit.prototype.cancelEdit = function () {
8766
+
8767
+ if (this.currentCell) {
8768
+
8769
+ var cell = this.currentCell;
8770
+
8771
+ var component = this.currentCell.getComponent();
8772
+
8773
+ this.clearEditor();
8774
+
8775
+ cell.setValueActual(cell.getValue());
8776
+
8777
+ if (cell.column.cellEvents.cellEditCancelled) {
8778
+
8779
+ cell.column.cellEvents.cellEditCancelled(component);
8780
+ }
8781
+
8782
+ this.table.options.cellEditCancelled(component);
8783
+ }
8784
+ };
8785
+
8108
8786
  //return a formatted value for a cell
8109
8787
 
8110
8788
 
8111
8789
  Edit.prototype.bindEditor = function (cell) {
8112
8790
 
8113
8791
  var self = this,
8792
+ element = cell.getElement();
8793
+
8794
+ element.attr("tabindex", 0);
8795
+
8796
+ element.on("click", function (e) {
8797
+
8798
+ if (!$(this).hasClass("tabulator-editing")) {
8799
+
8800
+ $(this).focus();
8801
+ }
8802
+ });
8803
+
8804
+ element.on("mousedown", function (e) {
8805
+
8806
+ self.mouseClick = true;
8807
+ });
8808
+
8809
+ element.on("focus", function (e) {
8810
+
8811
+ self.edit(cell, e);
8812
+ });
8813
+ };
8814
+
8815
+ Edit.prototype.edit = function (cell, e, forceEdit) {
8816
+
8817
+ var self = this,
8818
+ allowEdit = true,
8114
8819
  rendered = function rendered() {},
8115
8820
  element = cell.getElement(),
8116
- mouseClick = false;
8821
+ cellEditor,
8822
+ component;
8117
8823
 
8118
8824
  //handle successfull value change
8119
8825
 
@@ -8129,7 +8835,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
8129
8835
 
8130
8836
  if (valid === true) {
8131
8837
 
8132
- self.clearEditor(cell);
8838
+ self.clearEditor();
8133
8839
 
8134
8840
  cell.setValue(value, true);
8135
8841
  } else {
@@ -8147,103 +8853,113 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
8147
8853
 
8148
8854
  function cancel() {
8149
8855
 
8150
- self.clearEditor(cell);
8151
-
8152
- cell.setValueActual(cell.getValue());
8153
-
8154
- self.table.options.cellEditCancelled(cell.getComponent());
8856
+ self.cancelEdit();
8155
8857
  };
8156
8858
 
8157
- element.attr("tabindex", 0);
8859
+ function onRendered(callback) {
8158
8860
 
8159
- element.on("click", function (e) {
8861
+ rendered = callback;
8862
+ }
8160
8863
 
8161
- if (!$(this).hasClass("tabulator-editing")) {
8864
+ if (!cell.column.extensions.edit.blocked) {
8162
8865
 
8163
- $(this).focus();
8866
+ if (e) {
8867
+
8868
+ e.stopPropagation();
8164
8869
  }
8165
- });
8166
8870
 
8167
- element.on("mousedown", function (e) {
8871
+ switch (_typeof(cell.column.extensions.edit.check)) {
8168
8872
 
8169
- mouseClick = true;
8170
- });
8873
+ case "function":
8171
8874
 
8172
- element.on("focus", function (e) {
8875
+ allowEdit = cell.column.extensions.edit.check(cell.getComponent());
8173
8876
 
8174
- var allowEdit = true,
8175
- cellEditor;
8877
+ break;
8878
+
8879
+ case "boolean":
8176
8880
 
8177
- self.currentCell = cell;
8881
+ allowEdit = cell.column.extensions.edit.check;
8178
8882
 
8179
- function onRendered(callback) {
8883
+ break;
8180
8884
 
8181
- rendered = callback;
8182
8885
  }
8183
8886
 
8184
- if (!cell.column.extensions.edit.blocked) {
8887
+ if (allowEdit || forceEdit) {
8185
8888
 
8186
- e.stopPropagation();
8187
-
8188
- if (typeof cell.column.extensions.edit.check == "function") {
8889
+ self.cancelEdit();
8189
8890
 
8190
- allowEdit = cell.column.extensions.edit.check(cell.getComponent());
8191
- }
8891
+ self.currentCell = cell;
8192
8892
 
8193
- if (allowEdit) {
8893
+ component = cell.getComponent();
8194
8894
 
8195
- if (mouseClick) {
8895
+ if (this.mouseClick) {
8196
8896
 
8197
- mouseClick = false;
8897
+ this.mouseClick = false;
8198
8898
 
8199
- if (cell.column.cellEvents.cellClick) {
8899
+ if (cell.column.cellEvents.cellClick) {
8200
8900
 
8201
- cell.column.cellEvents.cellClick(e, cell.getComponent());
8202
- }
8901
+ cell.column.cellEvents.cellClick(component);
8203
8902
  }
8903
+ }
8204
8904
 
8205
- self.table.options.cellEditing(cell.getComponent());
8905
+ if (cell.column.cellEvents.cellEditing) {
8206
8906
 
8207
- cellEditor = cell.column.extensions.edit.editor.call(self, cell.getComponent(), onRendered, success, cancel, cell.column.extensions.edit.params);
8907
+ cell.column.cellEvents.cellEditing(component);
8908
+ }
8208
8909
 
8209
- //if editor returned, add to DOM, if false, abort edit
8910
+ self.table.options.cellEditing(component);
8210
8911
 
8912
+ cellEditor = cell.column.extensions.edit.editor.call(self, component, onRendered, success, cancel, cell.column.extensions.edit.params);
8211
8913
 
8212
- if (cellEditor !== false) {
8914
+ //if editor returned, add to DOM, if false, abort edit
8213
8915
 
8214
- element.addClass("tabulator-editing");
8215
8916
 
8216
- cell.row.getElement().addClass("tabulator-row-editing");
8917
+ if (cellEditor !== false) {
8217
8918
 
8218
- element.empty();
8919
+ element.addClass("tabulator-editing");
8219
8920
 
8220
- element.append(cellEditor);
8921
+ cell.row.getElement().addClass("tabulator-row-editing");
8221
8922
 
8222
- //trigger onRendered Callback
8923
+ element.empty();
8223
8924
 
8925
+ element.append(cellEditor);
8224
8926
 
8225
- rendered();
8927
+ //trigger onRendered Callback
8226
8928
 
8227
- //prevent editing from triggering rowClick event
8228
8929
 
8930
+ rendered();
8229
8931
 
8230
- element.children().click(function (e) {
8932
+ //prevent editing from triggering rowClick event
8231
8933
 
8232
- e.stopPropagation();
8233
- });
8234
- } else {
8235
8934
 
8236
- element.blur();
8237
- }
8935
+ element.children().click(function (e) {
8936
+
8937
+ e.stopPropagation();
8938
+ });
8238
8939
  } else {
8239
8940
 
8240
8941
  element.blur();
8942
+
8943
+ return false;
8241
8944
  }
8945
+
8946
+ return true;
8242
8947
  } else {
8243
8948
 
8949
+ this.mouseClick = false;
8950
+
8244
8951
  element.blur();
8952
+
8953
+ return false;
8245
8954
  }
8246
- });
8955
+ } else {
8956
+
8957
+ this.mouseClick = false;
8958
+
8959
+ element.blur();
8960
+
8961
+ return false;
8962
+ }
8247
8963
  };
8248
8964
 
8249
8965
  //default data editors
@@ -8402,7 +9118,98 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
8402
9118
 
8403
9119
  number: function number(cell, onRendered, success, cancel, editorParams) {
8404
9120
 
8405
- var input = $("<input type='number'/>");
9121
+ var max = typeof editorParams.max != "undefined" ? "max='" + editorParams.max + "'" : "";
9122
+
9123
+ var min = typeof editorParams.min != "undefined" ? "min='" + editorParams.min + "'" : "";
9124
+
9125
+ var step = "step='" + (typeof editorParams.step != "undefined" ? editorParams.step : 1) + "'";
9126
+
9127
+ var input = $("<input type='number' " + max + " " + min + " " + step + "/>");
9128
+
9129
+ //create and style input
9130
+
9131
+
9132
+ input.css({
9133
+
9134
+ "padding": "4px",
9135
+
9136
+ "width": "100%",
9137
+
9138
+ "box-sizing": "border-box"
9139
+
9140
+ }).val(cell.getValue());
9141
+
9142
+ onRendered(function () {
9143
+
9144
+ input.css("height", "100%");
9145
+
9146
+ setTimeout(function () {
9147
+
9148
+ input.focus();
9149
+ }, 10);
9150
+ });
9151
+
9152
+ //submit new value on blur
9153
+
9154
+
9155
+ input.on("blur", function (e) {
9156
+
9157
+ var value = input.val();
9158
+
9159
+ if (!isNaN(value)) {
9160
+
9161
+ value = Number(value);
9162
+ }
9163
+
9164
+ if (value != cell.getValue()) {
9165
+
9166
+ success(value);
9167
+ } else {
9168
+
9169
+ cancel();
9170
+ }
9171
+ });
9172
+
9173
+ //submit new value on enter
9174
+
9175
+
9176
+ input.on("keydown", function (e) {
9177
+
9178
+ var value;
9179
+
9180
+ if (e.keyCode == 13) {
9181
+
9182
+ value = input.val();
9183
+
9184
+ if (!isNaN(value)) {
9185
+
9186
+ value = Number(value);
9187
+ }
9188
+
9189
+ success(value);
9190
+ }
9191
+
9192
+ if (e.keyCode == 27) {
9193
+
9194
+ cancel();
9195
+ }
9196
+ });
9197
+
9198
+ return input;
9199
+ },
9200
+
9201
+ //input element with type of number
9202
+
9203
+
9204
+ range: function range(cell, onRendered, success, cancel, editorParams) {
9205
+
9206
+ var max = "max='" + (typeof editorParams.max != "undefined" ? editorParams.max : 10) + "'";
9207
+
9208
+ var min = "min='" + (typeof editorParams.min != "undefined" ? editorParams.min : 0) + "'";
9209
+
9210
+ var step = "step='" + (typeof editorParams.step != "undefined" ? editorParams.step : 1) + "'";
9211
+
9212
+ var input = $("<input type='range' " + max + " " + min + " " + step + "/>");
8406
9213
 
8407
9214
  //create and style input
8408
9215
 
@@ -8476,6 +9283,110 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
8476
9283
  return input;
8477
9284
  },
8478
9285
 
9286
+ //select
9287
+
9288
+
9289
+ select: function select(cell, onRendered, success, cancel, editorParams) {
9290
+
9291
+ //create and style select
9292
+
9293
+
9294
+ var select = $("<select><select/>");
9295
+
9296
+ var isArray = Array.isArray(editorParams);
9297
+
9298
+ if (typeof editorParams == "function") {
9299
+
9300
+ editorParams = editorParams(cell);
9301
+
9302
+ isArray = Array.isArray(editorParams);
9303
+ }
9304
+
9305
+ function optionAppend(element, label, value, disabled) {
9306
+
9307
+ var option = $("<option></option>").attr("value", value).text(label);
9308
+
9309
+ if (disabled) {
9310
+
9311
+ option.prop("disabled", true);
9312
+ }
9313
+
9314
+ element.append(option);
9315
+ }
9316
+
9317
+ function processOption(element, option) {
9318
+
9319
+ var groupEl;
9320
+
9321
+ if (option.options) {
9322
+
9323
+ groupEl = $("<optgroup></optgroup>").attr("label", option.label);
9324
+
9325
+ option.options.forEach(function (item) {
9326
+
9327
+ processOption(groupEl, item);
9328
+ });
9329
+
9330
+ element.append(groupEl);
9331
+ } else {
9332
+
9333
+ optionAppend(element, typeof option.label == "undefined" ? option.value : option.label, typeof option.value == "undefined" ? option.label : option.value, option.disabled);
9334
+ }
9335
+ }
9336
+
9337
+ if (!isArray && (typeof editorParams === 'undefined' ? 'undefined' : _typeof(editorParams)) === "object") {
9338
+
9339
+ for (var key in editorParams) {
9340
+
9341
+ optionAppend(select, editorParams[key], key);
9342
+ }
9343
+ } else if (isArray) {
9344
+
9345
+ editorParams.forEach(function (item) {
9346
+
9347
+ processOption(select, item);
9348
+ });
9349
+ }
9350
+
9351
+ select.css({
9352
+
9353
+ "padding": "4px",
9354
+
9355
+ "width": "100%",
9356
+
9357
+ "box-sizing": "border-box",
9358
+
9359
+ "font-family": ""
9360
+
9361
+ }).val(cell.getValue());
9362
+
9363
+ onRendered(function () {
9364
+
9365
+ select.focus().click();
9366
+ });
9367
+
9368
+ //submit new value on blur
9369
+
9370
+
9371
+ select.on("change blur", function (e) {
9372
+
9373
+ success(select.val());
9374
+ });
9375
+
9376
+ //submit new value on enter
9377
+
9378
+
9379
+ select.on("keydown", function (e) {
9380
+
9381
+ if (e.keyCode === 13) {
9382
+
9383
+ success(select.val());
9384
+ }
9385
+ });
9386
+
9387
+ return select;
9388
+ },
9389
+
8479
9390
  //start rating
8480
9391
 
8481
9392
 
@@ -8972,6 +9883,12 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
8972
9883
  self.table.rowManager.filterRefresh();
8973
9884
  };
8974
9885
 
9886
+ column.extensions.filter = {
9887
+
9888
+ success: success
9889
+
9890
+ };
9891
+
8975
9892
  //handle aborted edit
8976
9893
 
8977
9894
 
@@ -9103,6 +10020,8 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
9103
10020
  }, 300);
9104
10021
  });
9105
10022
 
10023
+ column.extensions.filter.headerElement = editorElement;
10024
+
9106
10025
  //update number filtered columns on change
9107
10026
 
9108
10027
 
@@ -9152,6 +10071,61 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
9152
10071
  }
9153
10072
  };
9154
10073
 
10074
+ //hide all header filter elements (used to ensure correct column widths in "fitData" layout mode)
10075
+
10076
+
10077
+ Filter.prototype.hideHeaderFilterElements = function () {
10078
+
10079
+ this.headerFilterElements.forEach(function (element) {
10080
+
10081
+ element.hide();
10082
+ });
10083
+ };
10084
+
10085
+ //show all header filter elements (used to ensure correct column widths in "fitData" layout mode)
10086
+
10087
+
10088
+ Filter.prototype.showHeaderFilterElements = function () {
10089
+
10090
+ this.headerFilterElements.forEach(function (element) {
10091
+
10092
+ element.show();
10093
+ });
10094
+ };
10095
+
10096
+ //programatically set value of header filter
10097
+
10098
+
10099
+ Filter.prototype.setHeaderFilterFocus = function (column) {
10100
+
10101
+ if (column.extensions.filter && column.extensions.filter.headerElement) {
10102
+
10103
+ column.extensions.filter.headerElement.focus();
10104
+ } else {
10105
+
10106
+ console.warn("Column Filter Focus Error - No header filter set on column:", column.getField());
10107
+ }
10108
+ };
10109
+
10110
+ //programatically set value of header filter
10111
+
10112
+
10113
+ Filter.prototype.setHeaderFilterValue = function (column, value) {
10114
+
10115
+ if (column) {
10116
+
10117
+ if (column.extensions.filter && column.extensions.filter.headerElement) {
10118
+
10119
+ column.extensions.filter.headerElement.val(value);
10120
+
10121
+ column.extensions.filter.success(value);
10122
+ } else {
10123
+
10124
+ console.warn("Column Filter Error - No header filter set on column:", column.getField());
10125
+ }
10126
+ }
10127
+ };
10128
+
9155
10129
  //check if the filters has changed since last use
9156
10130
 
9157
10131
 
@@ -9240,6 +10214,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
9240
10214
  self.changed = true;
9241
10215
  }
9242
10216
  });
10217
+
10218
+ if (this.table.options.persistentFilter && this.table.extExists("persistence", true)) {
10219
+
10220
+ this.table.extensions.persistence.save("filter");
10221
+ }
9243
10222
  };
9244
10223
 
9245
10224
  //get all filters
@@ -9330,6 +10309,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
9330
10309
  console.warn("Filter Error - No matching filter type found, ignoring: ", filter.type);
9331
10310
  }
9332
10311
  });
10312
+
10313
+ if (this.table.options.persistentFilter && this.table.extExists("persistence", true)) {
10314
+
10315
+ this.table.extensions.persistence.save("filter");
10316
+ }
9333
10317
  };
9334
10318
 
9335
10319
  //clear filters
@@ -9345,6 +10329,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
9345
10329
  }
9346
10330
 
9347
10331
  this.changed = true;
10332
+
10333
+ if (this.table.options.persistentFilter && this.table.extExists("persistence", true)) {
10334
+
10335
+ this.table.extensions.persistence.save("filter");
10336
+ }
9348
10337
  };
9349
10338
 
9350
10339
  //clear header filters
@@ -9498,6 +10487,22 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
9498
10487
 
9499
10488
  return rowVal.toLowerCase().indexOf(filterVal.toLowerCase()) > -1 ? true : false;
9500
10489
  }
10490
+ },
10491
+
10492
+ //in array
10493
+
10494
+
10495
+ "in": function _in(filterVal, rowVal) {
10496
+
10497
+ if (Array.isArray(filterVal)) {
10498
+
10499
+ return filterVal.indexOf(rowVal) > -1;
10500
+ } else {
10501
+
10502
+ console.warn("Filter Error - filter value is not an array:", filterVal);
10503
+
10504
+ return false;
10505
+ }
9501
10506
  }
9502
10507
 
9503
10508
  };
@@ -9528,6 +10533,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
9528
10533
  if (self.formatters[column.definition.formatter]) {
9529
10534
 
9530
10535
  config.formatter = self.formatters[column.definition.formatter];
10536
+
10537
+ if (column.definition.formatter === "email") {
10538
+
10539
+ console.warn("The%c email%c formatter has been depricated and will be removed in version 4.0, use the %clink %cformatter with %cformatterParams:{urlPrefix:'mailto:'} %cinstead.", "font-weight:bold;", "font-weight:regular;", "font-weight:bold;", "font-weight:regular;", "font-weight:bold;", "font-weight:regular;");
10540
+ }
9531
10541
  } else {
9532
10542
 
9533
10543
  console.warn("Formatter Error - No such formatter found: ", column.definition.formatter);
@@ -9731,27 +10741,89 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
9731
10741
 
9732
10742
  link: function link(cell, formatterParams) {
9733
10743
 
9734
- var value = this.sanitizeHTML(cell.getValue());
10744
+ var value = this.sanitizeHTML(cell.getValue()),
10745
+ urlPrefix = formatterParams.urlPrefix || "",
10746
+ label = this.emptyToSpace(value),
10747
+ data;
9735
10748
 
9736
- return "<a href='" + value + "'>" + this.emptyToSpace(value) + "</a>";
9737
- },
10749
+ if (formatterParams.labelField) {
9738
10750
 
9739
- //image element
10751
+ data = cell.getData();
9740
10752
 
10753
+ label = data[formatterParams.labelField];
10754
+ }
9741
10755
 
9742
- image: function image(cell, formatterParams) {
10756
+ if (formatterParams.label) {
9743
10757
 
9744
- var value = this.sanitizeHTML(cell.getValue());
10758
+ switch (_typeof(formatterParams.label)) {
9745
10759
 
9746
- return "<img src='" + value + "'/>";
9747
- },
10760
+ case "string":
9748
10761
 
9749
- //tick or empty cell
10762
+ label = formatterParams.label;
9750
10763
 
10764
+ break;
9751
10765
 
9752
- tick: function tick(cell, formatterParams) {
10766
+ case "function":
9753
10767
 
9754
- var value = cell.getValue(),
10768
+ label = formatterParams.label(cell);
10769
+
10770
+ break;
10771
+
10772
+ }
10773
+ }
10774
+
10775
+ if (formatterParams.urlField) {
10776
+
10777
+ data = cell.getData();
10778
+
10779
+ value = data[formatterParams.urlField];
10780
+ }
10781
+
10782
+ if (formatterParams.url) {
10783
+
10784
+ switch (_typeof(formatterParams.url)) {
10785
+
10786
+ case "string":
10787
+
10788
+ value = formatterParams.url;
10789
+
10790
+ break;
10791
+
10792
+ case "function":
10793
+
10794
+ value = formatterParams.url(cell);
10795
+
10796
+ break;
10797
+
10798
+ }
10799
+ }
10800
+
10801
+ return "<a href='" + urlPrefix + value + "'>" + label + "</a>";
10802
+ },
10803
+
10804
+ //image element
10805
+
10806
+
10807
+ image: function image(cell, formatterParams) {
10808
+
10809
+ var value = this.sanitizeHTML(cell.getValue());
10810
+
10811
+ var el = $("<img src='" + value + "'/>");
10812
+
10813
+ el.on("load", function () {
10814
+
10815
+ cell.getRow().normalizeHeight();
10816
+ });
10817
+
10818
+ return el;
10819
+ },
10820
+
10821
+ //tick or empty cell
10822
+
10823
+
10824
+ tick: function tick(cell, formatterParams) {
10825
+
10826
+ var value = cell.getValue(),
9755
10827
  element = cell.getElement();
9756
10828
 
9757
10829
  var tick = '<svg enable-background="new 0 0 24 24" height="14" width="14" viewBox="0 0 24 24" xml:space="preserve" ><path fill="#2DC214" clip-rule="evenodd" d="M21.652,3.211c-0.293-0.295-0.77-0.295-1.061,0L9.41,14.34 c-0.293,0.297-0.771,0.297-1.062,0L3.449,9.351C3.304,9.203,3.114,9.13,2.923,9.129C2.73,9.128,2.534,9.201,2.387,9.351 l-2.165,1.946C0.078,11.445,0,11.63,0,11.823c0,0.194,0.078,0.397,0.223,0.544l4.94,5.184c0.292,0.296,0.771,0.776,1.062,1.07 l2.124,2.141c0.292,0.293,0.769,0.293,1.062,0l14.366-14.34c0.293-0.294,0.293-0.777,0-1.071L21.652,3.211z" fill-rule="evenodd"/></svg>';
@@ -9792,6 +10864,23 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
9792
10864
  }
9793
10865
  },
9794
10866
 
10867
+ //select
10868
+
10869
+
10870
+ lookup: function lookup(cell, formatterParams) {
10871
+
10872
+ var value = cell.getValue();
10873
+
10874
+ if (typeof formatterParams[value] === "undefined") {
10875
+
10876
+ console.warn('Missing display value for ' + value);
10877
+
10878
+ return value;
10879
+ }
10880
+
10881
+ return formatterParams[value];
10882
+ },
10883
+
9795
10884
  //star rating
9796
10885
 
9797
10886
 
@@ -9839,22 +10928,130 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
9839
10928
  element = cell.getElement(),
9840
10929
  max = formatterParams && formatterParams.max ? formatterParams.max : 100,
9841
10930
  min = formatterParams && formatterParams.min ? formatterParams.min : 0,
9842
- color = formatterParams && formatterParams.color ? formatterParams.color : "#2DC214",
9843
- percent;
10931
+ percent,
10932
+ percentValue,
10933
+ color,
10934
+ legend,
10935
+ legendColor;
9844
10936
 
9845
10937
  //make sure value is in range
9846
10938
 
9847
10939
 
9848
- value = parseFloat(value) <= max ? parseFloat(value) : max;
10940
+ percentValue = parseFloat(value) <= max ? parseFloat(value) : max;
9849
10941
 
9850
- value = parseFloat(value) >= min ? parseFloat(value) : min;
10942
+ percentValue = parseFloat(percentValue) >= min ? parseFloat(percentValue) : min;
9851
10943
 
9852
10944
  //workout percentage
9853
10945
 
9854
10946
 
9855
10947
  percent = (max - min) / 100;
9856
10948
 
9857
- value = 100 - Math.round((value - min) / percent);
10949
+ percentValue = 100 - Math.round((percentValue - min) / percent);
10950
+
10951
+ //set bar color
10952
+
10953
+
10954
+ switch (_typeof(formatterParams.color)) {
10955
+
10956
+ case "string":
10957
+
10958
+ color = formatterParams.color;
10959
+
10960
+ break;
10961
+
10962
+ case "function":
10963
+
10964
+ color = formatterParams.color(value);
10965
+
10966
+ break;
10967
+
10968
+ case "object":
10969
+
10970
+ if (Array.isArray(formatterParams.color)) {
10971
+
10972
+ var unit = 100 / formatterParams.color.length;
10973
+
10974
+ var index = Math.floor(percentValue / unit);
10975
+
10976
+ index = Math.min(index, formatterParams.color.length - 1);
10977
+
10978
+ color = formatterParams.color[formatterParams.color.length - 1 - index];
10979
+
10980
+ break;
10981
+ }
10982
+
10983
+ default:
10984
+
10985
+ color = "#2DC214";
10986
+
10987
+ }
10988
+
10989
+ //generate legend
10990
+
10991
+
10992
+ switch (_typeof(formatterParams.legend)) {
10993
+
10994
+ case "string":
10995
+
10996
+ legend = formatterParams.legend;
10997
+
10998
+ break;
10999
+
11000
+ case "function":
11001
+
11002
+ legend = formatterParams.legend(value);
11003
+
11004
+ break;
11005
+
11006
+ case "boolean":
11007
+
11008
+ legend = value;
11009
+
11010
+ break;
11011
+
11012
+ default:
11013
+
11014
+ legend = false;
11015
+
11016
+ }
11017
+
11018
+ //set legend color
11019
+
11020
+
11021
+ switch (_typeof(formatterParams.legendColor)) {
11022
+
11023
+ case "string":
11024
+
11025
+ legendColor = formatterParams.legendColor;
11026
+
11027
+ break;
11028
+
11029
+ case "function":
11030
+
11031
+ legendColor = formatterParams.legendColor(value);
11032
+
11033
+ break;
11034
+
11035
+ case "object":
11036
+
11037
+ if (Array.isArray(formatterParams.legendColor)) {
11038
+
11039
+ var unit = 100 / formatterParams.legendColor.length;
11040
+
11041
+ var index = Math.floor(percentValue / unit);
11042
+
11043
+ index = Math.min(index, formatterParams.legendColor.length - 1);
11044
+
11045
+ legendColor = formatterParams.legendColor[formatterParams.legendColor.length - 1 - index];
11046
+
11047
+ break;
11048
+ }
11049
+
11050
+ default:
11051
+
11052
+ legendColor = "#000";
11053
+
11054
+ }
9858
11055
 
9859
11056
  element.css({
9860
11057
 
@@ -9864,9 +11061,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
9864
11061
 
9865
11062
  });
9866
11063
 
9867
- element.attr("aria-label", value);
11064
+ element.attr("aria-label", percentValue);
9868
11065
 
9869
- return "<div style='position:absolute; top:8px; bottom:8px; left:4px; right:" + value + "%; margin-right:4px; background-color:" + color + "; display:inline-block;' data-max='" + max + "' data-min='" + min + "'></div>";
11066
+ return "<div style='position:absolute; top:8px; bottom:8px; left:4px; right:" + percentValue + "%; margin-right:4px; background-color:" + color + "; display:inline-block;' data-max='" + max + "' data-min='" + min + "'></div>" + (legend ? "<div style='position:absolute; top:4px; left:0; text-align:center; width:100%; color:" + legendColor + ";'>" + legend + "</div>" : "");
9870
11067
  },
9871
11068
 
9872
11069
  //background color
@@ -10137,6 +11334,101 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
10137
11334
 
10138
11335
  Tabulator.registerExtension("frozenColumns", FrozenColumns);
10139
11336
 
11337
+ var FrozenRows = function FrozenRows(table) {
11338
+
11339
+ this.table = table; //hold Tabulator object
11340
+
11341
+
11342
+ this.topElement = $("<div class='tabulator-frozen-rows-holder'></div>");
11343
+
11344
+ this.rows = [];
11345
+ };
11346
+
11347
+ FrozenRows.prototype.initialize = function () {
11348
+
11349
+ this.rows = [];
11350
+
11351
+ this.table.columnManager.element.append(this.topElement);
11352
+ };
11353
+
11354
+ FrozenRows.prototype.filterFrozenRows = function () {
11355
+
11356
+ var self = this,
11357
+ frozen = [];
11358
+
11359
+ self.table.rowManager.displayRows.forEach(function (row, i) {
11360
+
11361
+ if (row.extensions.frozen == true) {
11362
+
11363
+ frozen.unshift(i);
11364
+ }
11365
+ });
11366
+
11367
+ frozen.forEach(function (index) {
11368
+
11369
+ self.table.rowManager.displayRows.splice(index, 1);
11370
+ });
11371
+ };
11372
+
11373
+ FrozenRows.prototype.freezeRow = function (row) {
11374
+
11375
+ if (!row.extensions.frozen) {
11376
+
11377
+ row.extensions.frozen = true;
11378
+
11379
+ this.topElement.append(row.getElement());
11380
+
11381
+ this.table.rowManager.adjustTableSize();
11382
+
11383
+ this.table.rowManager.refreshActiveData();
11384
+
11385
+ this.rows.push(row);
11386
+
11387
+ this.styleRows();
11388
+ } else {
11389
+
11390
+ console.warn("Freeze Error - Row is already frozen");
11391
+ }
11392
+ };
11393
+
11394
+ FrozenRows.prototype.unfreezeRow = function (row) {
11395
+
11396
+ var index = this.rows.indexOf(row);
11397
+
11398
+ if (row.extensions.frozen) {
11399
+
11400
+ row.extensions.frozen = false;
11401
+
11402
+ row.getElement().detach();
11403
+
11404
+ this.table.rowManager.adjustTableSize();
11405
+
11406
+ this.table.rowManager.refreshActiveData();
11407
+
11408
+ this.rows.splice(index, 1);
11409
+
11410
+ if (this.rows.length) {
11411
+
11412
+ this.styleRows();
11413
+ }
11414
+ } else {
11415
+
11416
+ console.warn("Freeze Error - Row is already unfrozen");
11417
+ }
11418
+ };
11419
+
11420
+ FrozenRows.prototype.styleRows = function (row) {
11421
+
11422
+ var self = this;
11423
+
11424
+ this.rows.forEach(function (row, i) {
11425
+
11426
+ self.table.rowManager.styleRow(row, i);
11427
+ });
11428
+ };
11429
+
11430
+ Tabulator.registerExtension("frozenRows", FrozenRows);
11431
+
10140
11432
  //public group object
10141
11433
 
10142
11434
 
@@ -10220,7 +11512,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
10220
11512
  //////////////////////////////////////////////////
10221
11513
 
10222
11514
 
10223
- var Group = function Group(groupManager, parent, level, key, generator, oldGroup) {
11515
+ var Group = function Group(groupManager, parent, level, key, field, generator, oldGroup) {
10224
11516
 
10225
11517
  this.groupManager = groupManager;
10226
11518
 
@@ -10230,6 +11522,8 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
10230
11522
 
10231
11523
  this.level = level;
10232
11524
 
11525
+ this.field = field;
11526
+
10233
11527
  this.hasSubGroups = level < groupManager.groupIDLookups.length - 1;
10234
11528
 
10235
11529
  this.addRow = this.hasSubGroups ? this._addRowToGroup : this._addRow;
@@ -10249,7 +11543,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
10249
11543
 
10250
11544
  this.element = $("<div class='tabulator-row tabulator-group tabulator-group-level-" + level + "' role='rowgroup'></div>");
10251
11545
 
10252
- this.arrowElement = $("<div class='tabulator-arrow'></div>");
11546
+ this.elementContents = $(""), this.arrowElement = $("<div class='tabulator-arrow'></div>");
10253
11547
 
10254
11548
  this.height = 0;
10255
11549
 
@@ -10261,6 +11555,8 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
10261
11555
 
10262
11556
  this.initialized = false;
10263
11557
 
11558
+ this.extensions = {};
11559
+
10264
11560
  this.visible = oldGroup ? oldGroup.visible : typeof groupManager.startOpen[level] !== "undefined" ? groupManager.startOpen[level] : groupManager.startOpen[0];
10265
11561
 
10266
11562
  this.addBindings();
@@ -10274,20 +11570,6 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
10274
11570
  tap,
10275
11571
  toggleElement;
10276
11572
 
10277
- if (self.groupManager.table.options.groupToggleElement) {
10278
-
10279
- toggleElement = self.groupManager.table.options.groupToggleElement == "arrow" ? self.arrowElement : self.element;
10280
-
10281
- toggleElement.on("click", function (e) {
10282
-
10283
- e.stopPropagation();
10284
-
10285
- e.stopImmediatePropagation();
10286
-
10287
- self.toggleVisibility();
10288
- });
10289
- }
10290
-
10291
11573
  //handle group click events
10292
11574
 
10293
11575
 
@@ -10387,6 +11669,20 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
10387
11669
  tapHold = null;
10388
11670
  });
10389
11671
  }
11672
+
11673
+ if (self.groupManager.table.options.groupToggleElement) {
11674
+
11675
+ toggleElement = self.groupManager.table.options.groupToggleElement == "arrow" ? self.arrowElement : self.element;
11676
+
11677
+ toggleElement.on("click", function (e) {
11678
+
11679
+ e.stopPropagation();
11680
+
11681
+ e.stopImmediatePropagation();
11682
+
11683
+ self.toggleVisibility();
11684
+ });
11685
+ }
10390
11686
  };
10391
11687
 
10392
11688
  Group.prototype._addRowToGroup = function (row) {
@@ -10395,11 +11691,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
10395
11691
 
10396
11692
  if (this.hasSubGroups) {
10397
11693
 
10398
- var groupID = this.groupManager.groupIDLookups[level](row.getData());
11694
+ var groupID = this.groupManager.groupIDLookups[level].func(row.getData());
10399
11695
 
10400
11696
  if (!this.groups[groupID]) {
10401
11697
 
10402
- var group = new Group(this.groupManager, this, level, groupID, this.groupManager.headerGenerator[level] || this.groupManager.headerGenerator[0], this.old ? this.old.groups[groupID] : false);
11698
+ var group = new Group(this.groupManager, this, level, groupID, this.groupManager.groupIDLookups[level].field, this.groupManager.headerGenerator[level] || this.groupManager.headerGenerator[0], this.old ? this.old.groups[groupID] : false);
10403
11699
 
10404
11700
  this.groups[groupID] = group;
10405
11701
 
@@ -10413,6 +11709,122 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
10413
11709
  Group.prototype._addRow = function (row) {
10414
11710
 
10415
11711
  this.rows.push(row);
11712
+
11713
+ row.extensions.group = this;
11714
+ };
11715
+
11716
+ Group.prototype.insertRow = function (row, to, after) {
11717
+
11718
+ var data = this.conformRowData({});
11719
+
11720
+ row.updateData(data);
11721
+
11722
+ var toIndex = this.rows.indexOf(to);
11723
+
11724
+ if (toIndex > -1) {
11725
+
11726
+ if (after) {
11727
+
11728
+ this.rows.splice(toIndex + 1, 0, row);
11729
+ } else {
11730
+
11731
+ this.rows.splice(toIndex, 0, row);
11732
+ }
11733
+ } else {
11734
+
11735
+ if (after) {
11736
+
11737
+ this.rows.push(row);
11738
+ } else {
11739
+
11740
+ this.rows.unshift(row);
11741
+ }
11742
+ }
11743
+
11744
+ row.extensions.group = this;
11745
+
11746
+ this.generateGroupHeaderContents();
11747
+
11748
+ if (this.groupManager.table.extExists("columnCalcs")) {
11749
+
11750
+ this.groupManager.table.extensions.columnCalcs.recalcGroup(this);
11751
+ }
11752
+ };
11753
+
11754
+ Group.prototype.getRowIndex = function (row) {};
11755
+
11756
+ //update row data to match grouping contraints
11757
+
11758
+
11759
+ Group.prototype.conformRowData = function (data) {
11760
+
11761
+ if (this.field) {
11762
+
11763
+ data[this.field] = this.key;
11764
+ } else {
11765
+
11766
+ console.warn("Data Conforming Error - Cannot conform row data to match new group as groupBy is a function");
11767
+ }
11768
+
11769
+ if (this.parent) {
11770
+
11771
+ data = this.parent.conformRowData(data);
11772
+ }
11773
+
11774
+ return data;
11775
+ };
11776
+
11777
+ Group.prototype.removeRow = function (row) {
11778
+
11779
+ var index = this.rows.indexOf(row);
11780
+
11781
+ if (index > -1) {
11782
+
11783
+ this.rows.splice(index, 1);
11784
+ }
11785
+
11786
+ if (!this.rows.length) {
11787
+
11788
+ if (this.parent) {
11789
+
11790
+ this.parent.removeGroup(this);
11791
+ } else {
11792
+
11793
+ this.groupManager.removeGroup(this);
11794
+ }
11795
+
11796
+ this.groupManager.updateGroupRows(true);
11797
+ } else {
11798
+
11799
+ this.generateGroupHeaderContents();
11800
+
11801
+ if (this.groupManager.table.extExists("columnCalcs")) {
11802
+
11803
+ this.groupManager.table.extensions.columnCalcs.recalcGroup(this);
11804
+ }
11805
+ }
11806
+ };
11807
+
11808
+ Group.prototype.removeGroup = function (group) {
11809
+
11810
+ var index;
11811
+
11812
+ if (this.groups[group.key]) {
11813
+
11814
+ delete this.groups[group.key];
11815
+
11816
+ index = this.groupList.indexOf(group);
11817
+
11818
+ if (index > -1) {
11819
+
11820
+ this.groupList.splice(index, 1);
11821
+ }
11822
+
11823
+ if (!this.groupList.length) {
11824
+
11825
+ this.parent.removeGroup();
11826
+ }
11827
+ }
10416
11828
  };
10417
11829
 
10418
11830
  Group.prototype.getHeadersAndRows = function () {
@@ -10599,21 +12011,28 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
10599
12011
  return match;
10600
12012
  };
10601
12013
 
10602
- ////////////// Standard Row Functions //////////////
12014
+ Group.prototype.generateGroupHeaderContents = function () {
10603
12015
 
12016
+ var data = [];
10604
12017
 
10605
- Group.prototype.getElement = function () {
12018
+ this.rows.forEach(function (row) {
10606
12019
 
10607
- this.addBindingsd = false;
12020
+ data.push(row.getData());
12021
+ });
10608
12022
 
10609
- this._visSet();
12023
+ this.elementContents = this.generator(this.key, this.getRowCount(), data, this.getComponent());
10610
12024
 
10611
- var data = [];
12025
+ this.element.empty().append(this.elementContents).prepend(this.arrowElement);
12026
+ };
10612
12027
 
10613
- this.rows.forEach(function (row) {
12028
+ ////////////// Standard Row Functions //////////////
12029
+
12030
+
12031
+ Group.prototype.getElement = function () {
12032
+
12033
+ this.addBindingsd = false;
10614
12034
 
10615
- data.push(row.getData());
10616
- });
12035
+ this._visSet();
10617
12036
 
10618
12037
  if (this.visible) {
10619
12038
 
@@ -10625,7 +12044,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
10625
12044
 
10626
12045
  this.element.children().detach();
10627
12046
 
10628
- this.element.html(this.generator(this.key, this.getRowCount(), data, this.getComponent())).prepend(this.arrowElement);
12047
+ this.generateGroupHeaderContents();
10629
12048
 
10630
12049
  // this.addBindings();
10631
12050
 
@@ -10681,6 +12100,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
10681
12100
  return this.outerHeight;
10682
12101
  };
10683
12102
 
12103
+ Group.prototype.getGroup = function () {
12104
+
12105
+ return this;
12106
+ };
12107
+
10684
12108
  Group.prototype.reinitializeHeight = function () {};
10685
12109
 
10686
12110
  Group.prototype.calcHeight = function () {};
@@ -10755,7 +12179,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
10755
12179
  //header layout function
10756
12180
 
10757
12181
 
10758
- return value + "<span>(" + count + " " + (count === 1 ? langValue : lang.groups.items) + ")</span>";
12182
+ return (typeof value === "undefined" ? "" : value) + "<span>(" + count + " " + (count === 1 ? langValue : lang.groups.items) + ")</span>";
10759
12183
  };
10760
12184
  });
10761
12185
 
@@ -10819,7 +12243,13 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
10819
12243
  }
10820
12244
  }
10821
12245
 
10822
- self.groupIDLookups.push(lookupFunc);
12246
+ self.groupIDLookups.push({
12247
+
12248
+ field: typeof group === "function" ? false : group,
12249
+
12250
+ func: lookupFunc
12251
+
12252
+ });
10823
12253
  });
10824
12254
 
10825
12255
  if (startOpen) {
@@ -10874,13 +12304,10 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
10874
12304
 
10875
12305
  var groupComponents = [];
10876
12306
 
10877
- if (this.table.options.dataGrouped) {
10878
-
10879
- this.groupList.forEach(function (group) {
12307
+ this.groupList.forEach(function (group) {
10880
12308
 
10881
- groupComponents.push(group.getComponent());
10882
- });
10883
- }
12309
+ groupComponents.push(group.getComponent());
12310
+ });
10884
12311
 
10885
12312
  return groupComponents;
10886
12313
  };
@@ -10918,19 +12345,28 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
10918
12345
 
10919
12346
  rows.forEach(function (row) {
10920
12347
 
10921
- var groupID = self.groupIDLookups[0](row.getData());
12348
+ self.assignRowToGroup(row, oldGroups);
12349
+ });
12350
+ };
10922
12351
 
10923
- if (!self.groups[groupID]) {
12352
+ GroupRows.prototype.assignRowToGroup = function (row, oldGroups) {
10924
12353
 
10925
- var group = new Group(self, false, 0, groupID, self.headerGenerator[0], oldGroups[groupID]);
12354
+ var groupID = this.groupIDLookups[0].func(row.getData()),
12355
+ oldGroups = oldGroups || [],
12356
+ newGroupNeeded = !this.groups[groupID];
10926
12357
 
10927
- self.groups[groupID] = group;
12358
+ if (newGroupNeeded) {
10928
12359
 
10929
- self.groupList.push(group);
10930
- }
12360
+ var group = new Group(this, false, 0, groupID, this.groupIDLookups[0].field, this.headerGenerator[0], oldGroups[groupID]);
10931
12361
 
10932
- self.groups[groupID].addRow(row);
10933
- });
12362
+ this.groups[groupID] = group;
12363
+
12364
+ this.groupList.push(group);
12365
+ }
12366
+
12367
+ this.groups[groupID].addRow(row);
12368
+
12369
+ return !newGroupNeeded;
10934
12370
  };
10935
12371
 
10936
12372
  GroupRows.prototype.updateGroupRows = function (force) {
@@ -10949,11 +12385,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
10949
12385
 
10950
12386
  if (force) {
10951
12387
 
10952
- oldRowCount = self.table.rowManager.displayRowsCount;
10953
-
10954
12388
  self.table.rowManager.setDisplayRows(output);
10955
12389
 
10956
- self.table.rowManager._virtualRenderFill(Math.floor(self.table.rowManager.element.scrollTop() / self.table.rowManager.element[0].scrollHeight * oldRowCount));
12390
+ self.table.rowManager.reRenderInPosition();
10957
12391
  }
10958
12392
 
10959
12393
  return output;
@@ -10967,6 +12401,23 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
10967
12401
  });
10968
12402
  };
10969
12403
 
12404
+ GroupRows.prototype.removeGroup = function (group) {
12405
+
12406
+ var index;
12407
+
12408
+ if (this.groups[group.key]) {
12409
+
12410
+ delete this.groups[group.key];
12411
+
12412
+ index = this.groupList.indexOf(group);
12413
+
12414
+ if (index > -1) {
12415
+
12416
+ this.groupList.splice(index, 1);
12417
+ }
12418
+ }
12419
+ };
12420
+
10970
12421
  Tabulator.registerExtension("groupRows", GroupRows);
10971
12422
 
10972
12423
  var History = function History(table) {
@@ -10988,10 +12439,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
10988
12439
 
10989
12440
  History.prototype.action = function (type, component, data) {
10990
12441
 
10991
- if (this.index > -1) {
10992
-
10993
- this.history = this.history.slice(0, this.index + 1);
10994
- }
12442
+ this.history = this.history.slice(0, this.index + 1);
10995
12443
 
10996
12444
  this.history.push({
10997
12445
 
@@ -11016,6 +12464,8 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
11016
12464
 
11017
12465
  this.index--;
11018
12466
 
12467
+ this.table.options.historyUndo(action.type, action.component, action.data);
12468
+
11019
12469
  return true;
11020
12470
  } else {
11021
12471
 
@@ -11035,6 +12485,8 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
11035
12485
 
11036
12486
  this.redoers[action.type].call(this, action);
11037
12487
 
12488
+ this.table.options.historyRedo(action.type, action.component, action.data);
12489
+
11038
12490
  return true;
11039
12491
  } else {
11040
12492
 
@@ -11061,6 +12513,13 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
11061
12513
  var newRow = this.table.rowManager.addRowActual(action.data.data, action.data.pos, action.data.index);
11062
12514
 
11063
12515
  this._rebindRow(action.component, newRow);
12516
+ },
12517
+
12518
+ rowMoved: function rowMoved(action) {
12519
+
12520
+ this.table.rowManager.moveRowActual(action.component, this.table.rowManager.rows[action.data.pos], false);
12521
+
12522
+ this.table.rowManager.redraw();
11064
12523
  }
11065
12524
 
11066
12525
  };
@@ -11082,6 +12541,13 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
11082
12541
  rowDelete: function rowDelete(action) {
11083
12542
 
11084
12543
  action.component.delete();
12544
+ },
12545
+
12546
+ rowMoved: function rowMoved(action) {
12547
+
12548
+ this.table.rowManager.moveRowActual(action.component, action.data.to, action.data.after);
12549
+
12550
+ this.table.rowManager.redraw();
11085
12551
  }
11086
12552
 
11087
12553
  };
@@ -12430,13 +13896,13 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
12430
13896
 
12431
13897
  this.pagesElement = $("<span class='tabulator-pages'></span>");
12432
13898
 
12433
- this.firstBut = $("<button class='tabulator-page' data-page='first' role='button' aria-label='' title=''></button>");
13899
+ this.firstBut = $("<button class='tabulator-page' data-page='first' role='button' aria-label='' title='' type='button'></button>");
12434
13900
 
12435
- this.prevBut = $("<button class='tabulator-page' data-page='prev' role='button' aria-label='' title=''></button>");
13901
+ this.prevBut = $("<button class='tabulator-page' data-page='prev' role='button' aria-label='' title='' type='button'></button>");
12436
13902
 
12437
- this.nextBut = $("<button class='tabulator-page' data-page='next' role='button' aria-label='' title=''></button>");
13903
+ this.nextBut = $("<button class='tabulator-page' data-page='next' role='button' aria-label='' title='' type='button'></button>");
12438
13904
 
12439
- this.lastBut = $("<button class='tabulator-page' data-page='last' role='button' aria-label='' title=''></button>");
13905
+ this.lastBut = $("<button class='tabulator-page' data-page='last' role='button' aria-label='' title='' type='button'></button>");
12440
13906
 
12441
13907
  this.mode = "local";
12442
13908
 
@@ -13003,7 +14469,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
13003
14469
 
13004
14470
  Tabulator.registerExtension("page", Page);
13005
14471
 
13006
- var PersistentLayout = function PersistentLayout(table) {
14472
+ var Persistence = function Persistence(table) {
13007
14473
 
13008
14474
  this.table = table; //hold Tabulator object
13009
14475
 
@@ -13018,7 +14484,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
13018
14484
  //setup parameters
13019
14485
 
13020
14486
 
13021
- PersistentLayout.prototype.initialize = function (mode, id) {
14487
+ Persistence.prototype.initialize = function (mode, id) {
13022
14488
 
13023
14489
  //determine persistent layout storage type
13024
14490
 
@@ -13034,15 +14500,31 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
13034
14500
  //load saved definitions
13035
14501
 
13036
14502
 
13037
- PersistentLayout.prototype.load = function (definition) {
14503
+ Persistence.prototype.load = function (type, current) {
14504
+
14505
+ var data = this.retreiveData(type);
14506
+
14507
+ if (current) {
14508
+
14509
+ data = data ? this.mergeDefinition(current, data) : current;
14510
+ }
14511
+
14512
+ return data;
14513
+ };
14514
+
14515
+ //retreive data from memory
14516
+
13038
14517
 
13039
- var newDefinition = "";
14518
+ Persistence.prototype.retreiveData = function (type) {
14519
+
14520
+ var data = "",
14521
+ id = this.id + (type === "columns" ? "" : "-" + type);
13040
14522
 
13041
14523
  switch (this.mode) {
13042
14524
 
13043
14525
  case "local":
13044
14526
 
13045
- newDefinition = localStorage.getItem(this.id);
14527
+ data = localStorage.getItem(id);
13046
14528
 
13047
14529
  break;
13048
14530
 
@@ -13052,7 +14534,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
13052
14534
 
13053
14535
 
13054
14536
  var cookie = document.cookie,
13055
- cookiePos = cookie.indexOf(this.id + "="),
14537
+ cookiePos = cookie.indexOf(id + "="),
13056
14538
  end = void 0;
13057
14539
 
13058
14540
  //if cookie exists, decode and load column data into tabulator
@@ -13069,7 +14551,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
13069
14551
  cookie = cookie.substr(0, end);
13070
14552
  }
13071
14553
 
13072
- newDefinition = cookie.replace(this.id + "=", "");
14554
+ data = cookie.replace(id + "=", "");
13073
14555
  }
13074
14556
 
13075
14557
  break;
@@ -13080,24 +14562,22 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
13080
14562
 
13081
14563
  }
13082
14564
 
13083
- if (newDefinition) {
13084
-
13085
- newDefinition = JSON.parse(newDefinition);
13086
-
13087
- definition = this.mergeDefinition(definition, newDefinition);
13088
- }
13089
-
13090
- return definition;
14565
+ return data ? JSON.parse(data) : false;
13091
14566
  };
13092
14567
 
13093
14568
  //merge old and new column defintions
13094
14569
 
13095
14570
 
13096
- PersistentLayout.prototype.mergeDefinition = function (oldCols, newCols) {
14571
+ Persistence.prototype.mergeDefinition = function (oldCols, newCols) {
13097
14572
 
13098
14573
  var self = this,
13099
14574
  output = [];
13100
14575
 
14576
+ // oldCols = oldCols || [];
14577
+
14578
+
14579
+ newCols = newCols || [];
14580
+
13101
14581
  newCols.forEach(function (column, to) {
13102
14582
 
13103
14583
  var from = self._findColumn(oldCols, column);
@@ -13123,7 +14603,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
13123
14603
  //find matching columns
13124
14604
 
13125
14605
 
13126
- PersistentLayout.prototype._findColumn = function (columns, subject) {
14606
+ Persistence.prototype._findColumn = function (columns, subject) {
13127
14607
 
13128
14608
  var type = subject.columns ? "group" : subject.field ? "field" : "object";
13129
14609
 
@@ -13153,19 +14633,67 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
13153
14633
  });
13154
14634
  };
13155
14635
 
13156
- //save current definitions
14636
+ //save data
14637
+
14638
+
14639
+ Persistence.prototype.save = function (type) {
14640
+
14641
+ var data = {};
14642
+
14643
+ switch (type) {
14644
+
14645
+ case "columns":
14646
+
14647
+ data = this.parseColumns(this.table.columnManager.getColumns());
14648
+
14649
+ break;
14650
+
14651
+ case "filter":
14652
+
14653
+ data = this.table.extensions.filter.getFilters();
14654
+
14655
+ break;
14656
+
14657
+ case "sort":
14658
+
14659
+ data = this.validateSorters(this.table.extensions.sort.getSort());
14660
+
14661
+ break;
14662
+
14663
+ }
14664
+
14665
+ var id = this.id + (type === "columns" ? "" : "-" + type);
14666
+
14667
+ this.saveData(id, data);
14668
+ };
14669
+
14670
+ //ensure sorters contain no function data
14671
+
14672
+
14673
+ Persistence.prototype.validateSorters = function (data) {
14674
+
14675
+ data.forEach(function (item) {
14676
+
14677
+ item.column = item.field;
14678
+
14679
+ delete item.field;
14680
+ });
14681
+
14682
+ return data;
14683
+ };
14684
+
14685
+ //save data to chosed medium
13157
14686
 
13158
14687
 
13159
- PersistentLayout.prototype.save = function () {
14688
+ Persistence.prototype.saveData = function (id, data) {
13160
14689
 
13161
- var definition = this.parseColumns(this.table.columnManager.getColumns()),
13162
- data = JSON.stringify(definition);
14690
+ data = JSON.stringify(data);
13163
14691
 
13164
14692
  switch (this.mode) {
13165
14693
 
13166
14694
  case "local":
13167
14695
 
13168
- localStorage.setItem(this.id, data);
14696
+ localStorage.setItem(id, data);
13169
14697
 
13170
14698
  break;
13171
14699
 
@@ -13178,7 +14706,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
13178
14706
  //save cookie
13179
14707
 
13180
14708
 
13181
- document.cookie = this.id + "=" + data + "; expires=" + expireDate.toUTCString();
14709
+ document.cookie = id + "=" + data + "; expires=" + expireDate.toUTCString();
13182
14710
 
13183
14711
  break;
13184
14712
 
@@ -13192,7 +14720,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
13192
14720
  //build premission list
13193
14721
 
13194
14722
 
13195
- PersistentLayout.prototype.parseColumns = function (columns) {
14723
+ Persistence.prototype.parseColumns = function (columns) {
13196
14724
 
13197
14725
  var self = this,
13198
14726
  definitions = [];
@@ -13223,7 +14751,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
13223
14751
  return definitions;
13224
14752
  };
13225
14753
 
13226
- Tabulator.registerExtension("persistentLayout", PersistentLayout);
14754
+ Tabulator.registerExtension("persistence", Persistence);
13227
14755
 
13228
14756
  var ResizeColumns = function ResizeColumns(table) {
13229
14757
 
@@ -13276,45 +14804,214 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
13276
14804
 
13277
14805
  var nearestColumn = column.getLastColumn();
13278
14806
 
13279
- if (nearestColumn) {
14807
+ if (nearestColumn) {
14808
+
14809
+ self.startColumn = column;
14810
+
14811
+ self._mouseDown(e, nearestColumn);
14812
+ }
14813
+ });
14814
+
14815
+ handle.addEventListener("mousedown", function (e) {
14816
+
14817
+ var nearestColumn = column.getLastColumn();
14818
+
14819
+ if (nearestColumn) {
14820
+
14821
+ self.startColumn = column;
14822
+
14823
+ self._mouseDown(e, nearestColumn);
14824
+ }
14825
+ });
14826
+
14827
+ //reszie column on double click
14828
+
14829
+
14830
+ handle.addEventListener("dblclick", function (e) {
14831
+
14832
+ column.reinitializeWidth(true);
14833
+ });
14834
+
14835
+ prevHandle.addEventListener("click", function (e) {
14836
+
14837
+ e.stopPropagation();
14838
+ });
14839
+
14840
+ prevHandle.addEventListener("mousedown", function (e) {
14841
+
14842
+ var nearestColumn, colIndex, prevColumn;
14843
+
14844
+ nearestColumn = column.getFirstColumn();
14845
+
14846
+ if (nearestColumn) {
14847
+
14848
+ colIndex = self.table.columnManager.findColumnIndex(nearestColumn);
14849
+
14850
+ prevColumn = colIndex > 0 ? self.table.columnManager.getColumnByIndex(colIndex - 1) : false;
14851
+
14852
+ if (prevColumn) {
14853
+
14854
+ self.startColumn = column;
14855
+
14856
+ self._mouseDown(e, prevColumn);
14857
+ }
14858
+ }
14859
+ });
14860
+
14861
+ //resize column on double click
14862
+
14863
+
14864
+ prevHandle.addEventListener("dblclick", function (e) {
14865
+
14866
+ var nearestColumn, colIndex, prevColumn;
14867
+
14868
+ nearestColumn = column.getFirstColumn();
14869
+
14870
+ if (nearestColumn) {
14871
+
14872
+ colIndex = self.table.columnManager.findColumnIndex(nearestColumn);
14873
+
14874
+ prevColumn = colIndex > 0 ? self.table.columnManager.getColumnByIndex(colIndex - 1) : false;
14875
+
14876
+ if (prevColumn) {
14877
+
14878
+ prevColumn.reinitializeWidth(true);
14879
+ }
14880
+ }
14881
+ });
14882
+
14883
+ element.append(handle).append(prevHandle);
14884
+ }
14885
+ };
14886
+
14887
+ ResizeColumns.prototype._mouseDown = function (e, column) {
14888
+
14889
+ var self = this;
14890
+
14891
+ self.table.element.addClass("tabulator-block-select");
14892
+
14893
+ function mouseMove(e) {
14894
+
14895
+ column.setWidth(self.startWidth + (e.screenX - self.startX));
14896
+
14897
+ if (!self.table.browserSlow && column.extensions.resize && column.extensions.resize.variableHeight) {
14898
+
14899
+ column.checkCellHeights();
14900
+ }
14901
+ }
14902
+
14903
+ function mouseUp(e) {
14904
+
14905
+ //block editor from taking action while resizing is taking place
14906
+
14907
+
14908
+ if (self.startColumn.extensions.edit) {
14909
+
14910
+ self.startColumn.extensions.edit.blocked = false;
14911
+ }
14912
+
14913
+ if (self.table.browserSlow && column.extensions.resize && column.extensions.resize.variableHeight) {
14914
+
14915
+ column.checkCellHeights();
14916
+ }
14917
+
14918
+ $("body").off("mouseup", mouseMove);
14919
+
14920
+ $("body").off("mousemove", mouseMove);
14921
+
14922
+ self.table.element.removeClass("tabulator-block-select");
14923
+
14924
+ if (self.table.options.persistentLayout && self.table.extExists("persistence", true)) {
14925
+
14926
+ self.table.extensions.persistence.save("columns");
14927
+ }
14928
+
14929
+ self.table.options.columnResized(self.startColumn.getComponent());
14930
+ }
14931
+
14932
+ e.stopPropagation(); //prevent resize from interfereing with movable columns
14933
+
14934
+
14935
+ //block editor from taking action while resizing is taking place
14936
+
14937
+
14938
+ if (self.startColumn.extensions.edit) {
14939
+
14940
+ self.startColumn.extensions.edit.blocked = true;
14941
+ }
14942
+
14943
+ self.startX = e.screenX;
14944
+
14945
+ self.startWidth = column.getWidth();
14946
+
14947
+ $("body").on("mousemove", mouseMove);
14948
+
14949
+ $("body").on("mouseup", mouseUp);
14950
+ };
14951
+
14952
+ Tabulator.registerExtension("resizeColumns", ResizeColumns);
14953
+
14954
+ var ResizeRows = function ResizeRows(table) {
14955
+
14956
+ this.table = table; //hold Tabulator object
14957
+
14958
+
14959
+ this.startColumn = false;
14960
+
14961
+ this.startY = false;
14962
+
14963
+ this.startHeight = false;
14964
+
14965
+ this.handle = null;
14966
+
14967
+ this.prevHandle = null;
14968
+ };
14969
+
14970
+ ResizeRows.prototype.initializeRow = function (row) {
14971
+
14972
+ var self = this;
14973
+
14974
+ var handle = document.createElement('div');
14975
+
14976
+ handle.className = "tabulator-row-resize-handle";
14977
+
14978
+ var prevHandle = document.createElement('div');
13280
14979
 
13281
- self.startColumn = column;
14980
+ prevHandle.className = "tabulator-row-resize-handle prev";
13282
14981
 
13283
- self._mouseDown(e, nearestColumn);
13284
- }
13285
- });
14982
+ handle.addEventListener("click", function (e) {
13286
14983
 
13287
- prevHandle.addEventListener("click", function (e) {
14984
+ e.stopPropagation();
14985
+ });
13288
14986
 
13289
- e.stopPropagation();
13290
- });
14987
+ handle.addEventListener("mousedown", function (e) {
13291
14988
 
13292
- prevHandle.addEventListener("mousedown", function (e) {
14989
+ self.startRow = row;
13293
14990
 
13294
- var nearestColumn, colIndex, prevColumn;
14991
+ self._mouseDown(e, row);
14992
+ });
13295
14993
 
13296
- nearestColumn = column.getFirstColumn();
14994
+ prevHandle.addEventListener("click", function (e) {
13297
14995
 
13298
- if (nearestColumn) {
14996
+ e.stopPropagation();
14997
+ });
13299
14998
 
13300
- colIndex = self.table.columnManager.findColumnIndex(nearestColumn);
14999
+ prevHandle.addEventListener("mousedown", function (e) {
13301
15000
 
13302
- prevColumn = colIndex > 0 ? self.table.columnManager.getColumnByIndex(colIndex - 1) : false;
15001
+ var prevRow = self.table.rowManager.prevDisplayRow(row);
13303
15002
 
13304
- if (prevColumn) {
15003
+ if (prevRow) {
13305
15004
 
13306
- self.startColumn = column;
15005
+ self.startRow = prevRow;
13307
15006
 
13308
- self._mouseDown(e, prevColumn);
13309
- }
13310
- }
13311
- });
15007
+ self._mouseDown(e, prevRow);
15008
+ }
15009
+ });
13312
15010
 
13313
- element.append(handle).append(prevHandle);
13314
- }
15011
+ row.getElement().append(handle).append(prevHandle);
13315
15012
  };
13316
15013
 
13317
- ResizeColumns.prototype._mouseDown = function (e, column) {
15014
+ ResizeRows.prototype._mouseDown = function (e, row) {
13318
15015
 
13319
15016
  var self = this;
13320
15017
 
@@ -13322,28 +15019,22 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
13322
15019
 
13323
15020
  function mouseMove(e) {
13324
15021
 
13325
- column.setWidth(self.startWidth + (e.screenX - self.startX));
13326
-
13327
- if (!self.table.browserSlow && column.extensions.resize && column.extensions.resize.variableHeight) {
13328
-
13329
- column.checkCellHeights();
13330
- }
15022
+ row.setHeight(self.startHeight + (e.screenY - self.startY));
13331
15023
  }
13332
15024
 
13333
15025
  function mouseUp(e) {
13334
15026
 
13335
- //block editor from taking action while resizing is taking place
15027
+ // //block editor from taking action while resizing is taking place
13336
15028
 
13337
15029
 
13338
- if (self.startColumn.extensions.edit) {
15030
+ // if(self.startColumn.extensions.edit){
13339
15031
 
13340
- self.startColumn.extensions.edit.blocked = false;
13341
- }
13342
15032
 
13343
- if (self.table.browserSlow && column.extensions.resize && column.extensions.resize.variableHeight) {
15033
+ // self.startColumn.extensions.edit.blocked = false;
15034
+
15035
+
15036
+ // }
13344
15037
 
13345
- column.checkCellHeights();
13346
- }
13347
15038
 
13348
15039
  $("body").off("mouseup", mouseMove);
13349
15040
 
@@ -13351,12 +15042,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
13351
15042
 
13352
15043
  self.table.element.removeClass("tabulator-block-select");
13353
15044
 
13354
- if (self.table.options.persistentLayout && self.table.extExists("persistentLayout", true)) {
13355
-
13356
- self.table.extensions.persistentLayout.save();
13357
- }
13358
-
13359
- self.table.options.columnResized(self.startColumn.getComponent());
15045
+ self.table.options.rowResized(row.getComponent());
13360
15046
  }
13361
15047
 
13362
15048
  e.stopPropagation(); //prevent resize from interfereing with movable columns
@@ -13365,21 +15051,55 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
13365
15051
  //block editor from taking action while resizing is taking place
13366
15052
 
13367
15053
 
13368
- if (self.startColumn.extensions.edit) {
15054
+ // if(self.startColumn.extensions.edit){
13369
15055
 
13370
- self.startColumn.extensions.edit.blocked = true;
13371
- }
13372
15056
 
13373
- self.startX = e.screenX;
15057
+ // self.startColumn.extensions.edit.blocked = true;
13374
15058
 
13375
- self.startWidth = column.getWidth();
15059
+
15060
+ // }
15061
+
15062
+
15063
+ self.startY = e.screenY;
15064
+
15065
+ self.startHeight = row.getHeight();
13376
15066
 
13377
15067
  $("body").on("mousemove", mouseMove);
13378
15068
 
13379
15069
  $("body").on("mouseup", mouseUp);
13380
15070
  };
13381
15071
 
13382
- Tabulator.registerExtension("resizeColumns", ResizeColumns);
15072
+ Tabulator.registerExtension("resizeRows", ResizeRows);
15073
+
15074
+ var ResizeTable = function ResizeTable(table) {
15075
+
15076
+ this.table = table; //hold Tabulator object
15077
+
15078
+ };
15079
+
15080
+ ResizeTable.prototype.initialize = function (row) {
15081
+
15082
+ var table = this.table,
15083
+ observer;
15084
+
15085
+ if (typeof ResizeObserver !== "undefined") {
15086
+
15087
+ observer = new ResizeObserver(function (entry) {
15088
+
15089
+ table.redraw();
15090
+ });
15091
+
15092
+ observer.observe(table.element[0]);
15093
+ } else {
15094
+
15095
+ $(window).resize(function () {
15096
+
15097
+ $(".tabulator").tabulator("redraw");
15098
+ });
15099
+ }
15100
+ };
15101
+
15102
+ Tabulator.registerExtension("resizeTable", ResizeTable);
13383
15103
 
13384
15104
  var ResponsiveLayout = function ResponsiveLayout(table) {
13385
15105
 
@@ -13633,7 +15353,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
13633
15353
 
13634
15354
  self.table.rowManager.rows.forEach(function (row) {
13635
15355
 
13636
- self._selectRow(row, true, true);
15356
+ self._selectRow(row, false, true);
13637
15357
  });
13638
15358
 
13639
15359
  self._rowSelectionChanged();
@@ -13646,7 +15366,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
13646
15366
 
13647
15367
  self.table.rowManager.activeRows.forEach(function (row) {
13648
15368
 
13649
- self._selectRow(row, true, true);
15369
+ self._selectRow(row, false, true);
13650
15370
  });
13651
15371
 
13652
15372
  self._rowSelectionChanged();
@@ -13660,7 +15380,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
13660
15380
 
13661
15381
  rows.forEach(function (row) {
13662
15382
 
13663
- self._selectRow(row, true);
15383
+ self._selectRow(row);
13664
15384
  });
13665
15385
 
13666
15386
  self._rowSelectionChanged();
@@ -13691,7 +15411,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
13691
15411
 
13692
15412
  if (self.table.options.selectableRollingSelection) {
13693
15413
 
13694
- self._deselectRow(self.selectedRows[0], true);
15414
+ self._deselectRow(self.selectedRows[0]);
13695
15415
  } else {
13696
15416
 
13697
15417
  return false;
@@ -13719,7 +15439,10 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
13719
15439
  }
13720
15440
  } else {
13721
15441
 
13722
- console.warn("Selection Error - No such row found, ignoring selection:" + rowInfo);
15442
+ if (!silent) {
15443
+
15444
+ console.warn("Selection Error - No such row found, ignoring selection:" + rowInfo);
15445
+ }
13723
15446
  }
13724
15447
  };
13725
15448
 
@@ -13746,7 +15469,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
13746
15469
 
13747
15470
  rows.forEach(function (row) {
13748
15471
 
13749
- self._deselectRow(row, true);
15472
+ self._deselectRow(row);
13750
15473
  });
13751
15474
 
13752
15475
  self._rowSelectionChanged();
@@ -13790,7 +15513,10 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
13790
15513
  }
13791
15514
  } else {
13792
15515
 
13793
- console.warn("Selection Error - No such row found, ignoring selection:" + rowInfo);
15516
+ if (!silent) {
15517
+
15518
+ console.warn("Deselection Error - No such row found, ignoring selection:" + rowInfo);
15519
+ }
13794
15520
  }
13795
15521
  };
13796
15522
 
@@ -13995,6 +15721,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
13995
15721
  });
13996
15722
 
13997
15723
  self.sortList = newSortList;
15724
+
15725
+ if (this.table.options.persistentSort && this.table.extExists("persistence", true)) {
15726
+
15727
+ this.table.extensions.persistence.save("sort");
15728
+ }
13998
15729
  };
13999
15730
 
14000
15731
  //clear sorters
@@ -14203,7 +15934,27 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
14203
15934
 
14204
15935
  number: function number(a, b, aRow, bRow, column, dir, params) {
14205
15936
 
14206
- return parseFloat(String(a).replace(",", "")) - parseFloat(String(b).replace(",", ""));
15937
+ var a = parseFloat(String(a).replace(",", ""));
15938
+
15939
+ var b = parseFloat(String(b).replace(",", ""));
15940
+
15941
+ //handle non numeric values
15942
+
15943
+
15944
+ if (isNaN(a)) {
15945
+
15946
+ return -1;
15947
+
15948
+ if (isNaN(b)) {
15949
+
15950
+ return 0;
15951
+ }
15952
+ } else if (isNaN(b)) {
15953
+
15954
+ return 1;
15955
+ }
15956
+
15957
+ return a - b;
14207
15958
  },
14208
15959
 
14209
15960
  //sort strings
@@ -14211,7 +15962,28 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
14211
15962
 
14212
15963
  string: function string(a, b, aRow, bRow, column, dir, params) {
14213
15964
 
14214
- return String(a).toLowerCase().localeCompare(String(b).toLowerCase());
15965
+ var locale;
15966
+
15967
+ switch (_typeof(params.locale)) {
15968
+
15969
+ case "boolean":
15970
+
15971
+ if (params.locale) {
15972
+
15973
+ local = this.table.extensions.localize.getLocale();
15974
+ }
15975
+
15976
+ break;
15977
+
15978
+ case "string":
15979
+
15980
+ locale = params.locale;
15981
+
15982
+ break;
15983
+
15984
+ }
15985
+
15986
+ return String(a).toLowerCase().localeCompare(String(b).toLowerCase(), locale);
14215
15987
  },
14216
15988
 
14217
15989
  //sort date
@@ -14228,6 +16000,48 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
14228
16000
  a = moment(a, format);
14229
16001
 
14230
16002
  b = moment(b, format);
16003
+
16004
+ if (!a.isValid()) {
16005
+
16006
+ a = -1000000000000000;
16007
+ }
16008
+
16009
+ if (!b.isValid()) {
16010
+
16011
+ b = -1000000000000000;
16012
+ }
16013
+ } else {
16014
+
16015
+ console.error("Sort Error - 'date' sorter is dependant on moment.js");
16016
+ }
16017
+
16018
+ return a - b;
16019
+ },
16020
+
16021
+ //sort hh:mm formatted times
16022
+
16023
+
16024
+ time: function time(a, b, aRow, bRow, column, dir, params) {
16025
+
16026
+ var self = this;
16027
+
16028
+ var format = params.format || "hh:mm";
16029
+
16030
+ if (typeof moment != "undefined") {
16031
+
16032
+ a = moment(a, format);
16033
+
16034
+ b = moment(b, format);
16035
+
16036
+ if (!a.isValid()) {
16037
+
16038
+ a = -1000000000000000;
16039
+ }
16040
+
16041
+ if (!b.isValid()) {
16042
+
16043
+ b = -1000000000000000;
16044
+ }
14231
16045
  } else {
14232
16046
 
14233
16047
  console.error("Sort Error - 'date' sorter is dependant on moment.js");
@@ -14236,6 +16050,38 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
14236
16050
  return a - b;
14237
16051
  },
14238
16052
 
16053
+ //sort datetime
16054
+
16055
+
16056
+ datetime: function datetime(a, b, aRow, bRow, column, dir, params) {
16057
+
16058
+ var self = this;
16059
+
16060
+ var format = params.format || "DD/MM/YYYY hh:mm:ss";
16061
+
16062
+ if (typeof moment != "undefined") {
16063
+
16064
+ a = moment(a, format);
16065
+
16066
+ b = moment(b, format);
16067
+
16068
+ if (!a.isValid()) {
16069
+
16070
+ a = -1000000000000000;
16071
+ }
16072
+
16073
+ if (!b.isValid()) {
16074
+
16075
+ b = -1000000000000000;
16076
+ }
16077
+ } else {
16078
+
16079
+ console.error("Sort Error - 'datetime' sorter is dependant on moment.js");
16080
+ }
16081
+
16082
+ return a - b;
16083
+ },
16084
+
14239
16085
  //sort booleans
14240
16086
 
14241
16087
 
@@ -14248,6 +16094,95 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
14248
16094
  return el1 - el2;
14249
16095
  },
14250
16096
 
16097
+ //sort if element contains any data
16098
+
16099
+
16100
+ array: function array(a, b, aRow, bRow, column, dir, params) {
16101
+
16102
+ var el1 = 0;
16103
+
16104
+ var el2 = 0;
16105
+
16106
+ var type = params.type || "length";
16107
+
16108
+ //handle non array values
16109
+
16110
+
16111
+ if (!Array.isArray(a)) {
16112
+
16113
+ return -1;
16114
+
16115
+ if (!Array.isArray(b)) {
16116
+
16117
+ return 0;
16118
+ }
16119
+ } else if (!Array.isArray(b)) {
16120
+
16121
+ return 1;
16122
+ }
16123
+
16124
+ function calc(value) {
16125
+
16126
+ switch (type) {
16127
+
16128
+ case "length":
16129
+
16130
+ return value.length;
16131
+
16132
+ break;
16133
+
16134
+ case "sum":
16135
+
16136
+ return value.reduce(function (c, d) {
16137
+
16138
+ return c + d;
16139
+ });
16140
+
16141
+ break;
16142
+
16143
+ case "max":
16144
+
16145
+ return Math.max.apply(null, value);
16146
+
16147
+ break;
16148
+
16149
+ case "min":
16150
+
16151
+ return Math.min.apply(null, value);
16152
+
16153
+ break;
16154
+
16155
+ case "avg":
16156
+
16157
+ return value.reduce(function (c, d) {
16158
+
16159
+ return c + d;
16160
+ }) / value.length;
16161
+
16162
+ break;
16163
+
16164
+ }
16165
+ }
16166
+
16167
+ el1 = a ? calc(a) : 0;
16168
+
16169
+ el2 = b ? calc(b) : 0;
16170
+
16171
+ return el1 - el2;
16172
+ },
16173
+
16174
+ //sort if element contains any data
16175
+
16176
+
16177
+ exists: function exists(a, b, aRow, bRow, column, dir, params) {
16178
+
16179
+ var el1 = typeof a == "undefined" ? 0 : 1;
16180
+
16181
+ var el2 = typeof b == "undefined" ? 0 : 1;
16182
+
16183
+ return el1 - el2;
16184
+ },
16185
+
14251
16186
  //sort alpha numeric strings
14252
16187
 
14253
16188
 
@@ -14298,28 +16233,6 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
14298
16233
  }
14299
16234
 
14300
16235
  return a.length > b.length;
14301
- },
14302
-
14303
- //sort hh:mm formatted times
14304
-
14305
-
14306
- time: function time(a, b, aRow, bRow, column, dir, params) {
14307
-
14308
- var self = this;
14309
-
14310
- var format = params.format || "hh:mm";
14311
-
14312
- if (typeof moment != "undefined") {
14313
-
14314
- a = moment(a, format);
14315
-
14316
- b = moment(b, format);
14317
- } else {
14318
-
14319
- console.error("Sort Error - 'date' sorter is dependant on moment.js");
14320
- }
14321
-
14322
- return a - b;
14323
16236
  }
14324
16237
 
14325
16238
  };
@@ -14548,13 +16461,15 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
14548
16461
 
14549
16462
  var cellData = cell.getData();
14550
16463
 
16464
+ var column = cell.getColumn()._getSelf();
16465
+
14551
16466
  this.table.rowManager.rows.forEach(function (row) {
14552
16467
 
14553
16468
  var data = row.getData();
14554
16469
 
14555
16470
  if (data !== cellData) {
14556
16471
 
14557
- if (value == data[cell.getField()]) {
16472
+ if (value == column.getFieldValue(data)) {
14558
16473
 
14559
16474
  unique = false;
14560
16475
  }