1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.setRowsDelete = exports.setAllRowsDelete = exports.setRowDelete = undefined;
|
7 |
|
8 | var _util = require('./util');
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | var setRowDelete = function setRowDelete(index) {
|
15 | if (index instanceof Row) {
|
16 | index = this.getIndexByRowId(index.rowId);
|
17 | }
|
18 | this.setRowsDelete([index]);
|
19 | };
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | var setAllRowsDelete = function setAllRowsDelete() {
|
31 | var indices = new Array(this.rows().length);
|
32 | for (var i = 0; i < indices.length; i++) {
|
33 | indices[i] = i;
|
34 | }
|
35 | this.setRowsDelete(indices);
|
36 | };
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 | var setRowsDelete = function setRowsDelete(indices) {
|
43 | indices = (0, _util._formatToIndicesArray)(this, indices);
|
44 | var rowIds = this.getRowIdsByIndices(indices);
|
45 | this.trigger(DataTable.ON_DELETE, {
|
46 | falseDelete: true,
|
47 | indices: indices,
|
48 | rowIds: rowIds
|
49 | });
|
50 | for (var i = 0; i < indices.length; i++) {
|
51 | var row = this.getRow(indices[i]);
|
52 | if (row.status == Row.STATUS.NEW) {
|
53 | this.rows().splice(indices[i], 1);
|
54 | this.updateSelectedIndices(indices[i], '-');
|
55 | this.updateFocusIndex(index, '-');
|
56 | } else {
|
57 | row.status = Row.STATUS.FALSE_DELETE;
|
58 | var temprows = this.rows().splice(indices[i], 1);
|
59 | this.rows().push(temprows[0]);
|
60 | }
|
61 | }
|
62 | };
|
63 |
|
64 | exports.setRowDelete = setRowDelete;
|
65 | exports.setAllRowsDelete = setAllRowsDelete;
|
66 | exports.setRowsDelete = setRowsDelete; |
\ | No newline at end of file |