1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | import {
|
7 | utilFunObj
|
8 | } from './util';
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | const removeRowByRowId = function(rowId) {
|
18 | var index = this.getIndexByRowId(rowId)
|
19 | if (index != -1)
|
20 | this.removeRow(index)
|
21 | }
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | const removeRow = function(index) {
|
31 | if (index instanceof Row) {
|
32 | index = this.getIndexByRowId(index.rowId)
|
33 | }
|
34 | this.removeRows([index]);
|
35 | }
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 | const removeAllRows = function() {
|
44 | this.rows([])
|
45 | this.selectedIndices([])
|
46 | this.focusIndex(-1)
|
47 | this.trigger(DataTable.ON_DELETE_ALL)
|
48 | this.updateCurrIndex();
|
49 | }
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 | const removeRows = function(indices) {
|
59 | this.setRowsDelete(indices)
|
60 | }
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 | const clear = function() {
|
70 | this.removeAllRows();
|
71 | this.cachedPages = [];
|
72 | this.totalPages(1);
|
73 | this.pageIndex(0);
|
74 | this.focusIndex(-1);
|
75 | this.selectedIndices([]);
|
76 | }
|
77 |
|
78 | export const removeRowFunObj = {
|
79 | removeRowByRowId: removeRowByRowId,
|
80 | removeRow: removeRow,
|
81 | removeAllRows: removeAllRows,
|
82 | removeRows: removeRows,
|
83 | clear: clear
|
84 | }
|