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