1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | const getSelectedIndex = function () {
|
12 | var selectedIndices = this.selectedIndices()
|
13 | if (selectedIndices == null || selectedIndices.length == 0)
|
14 | return -1
|
15 | return selectedIndices[0]
|
16 | };
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | const getSelectedIndices = function () {
|
22 | var selectedIndices = this.selectedIndices()
|
23 | if (selectedIndices == null || selectedIndices.length == 0)
|
24 | return []
|
25 | return selectedIndices
|
26 | };
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | const getSelectedIndexs = function () {
|
32 | return this.getSelectedIndices();
|
33 | }
|
34 |
|
35 |
|
36 |
|
37 |
|
38 | const getSelectedDatas = function (withEmptyRow) {
|
39 | var selectedIndices = this.selectedIndices()
|
40 | var datas = []
|
41 | var sIndices = []
|
42 | for (var i = 0, count = selectedIndices.length; i < count; i++) {
|
43 | sIndices.push(selectedIndices[i])
|
44 | }
|
45 | var rows = this.rows();
|
46 | for (var i = 0, count = rows.length; i < count; i++) {
|
47 | if (sIndices.indexOf(i) != -1)
|
48 | datas.push(rows[i].getData())
|
49 | else if (withEmptyRow == true)
|
50 | datas.push(rows[i].getEmptyData())
|
51 | }
|
52 | return datas
|
53 | };
|
54 |
|
55 |
|
56 |
|
57 |
|
58 | const getSelectedRows = function (){
|
59 | var selectedIndices = this.selectedIndices();
|
60 | var selectRows = [];
|
61 | var rows = this.rows.peek();
|
62 | var sIndices = []
|
63 | for (var i = 0, count = selectedIndices.length; i < count; i++) {
|
64 | sIndices.push(selectedIndices[i])
|
65 | }
|
66 | for (var i = 0, count = rows.length; i < count; i++) {
|
67 | if (sIndices.indexOf(i) != -1)
|
68 | selectRows.push(rows[i])
|
69 | }
|
70 | return selectRows
|
71 | }
|
72 |
|
73 | export {
|
74 | getSelectedIndex,
|
75 | getSelectedIndices,
|
76 | getSelectedIndexs,
|
77 | getSelectedDatas,
|
78 | getSelectedRows
|
79 | } |
\ | No newline at end of file |