1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | const getData = function() {
|
15 | var datas = [],
|
16 | row, meta;
|
17 | meta = this.parent.getMeta()
|
18 | for (var i = 0; i < this.rows.length; i++) {
|
19 | row = this.rows[i];
|
20 | datas.push({
|
21 | 'id': row.rowId,
|
22 | 'status': row.status,
|
23 | data: row.data
|
24 | });
|
25 | }
|
26 | return datas
|
27 | }
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 | const getSelectDatas = function() {
|
38 | var datas = [],
|
39 | row;
|
40 | for (var i = 0; i < this.rows.length; i++) {
|
41 | row = this.rows[i];
|
42 | datas.push({
|
43 | 'id': row.rowId,
|
44 | 'status': row.status,
|
45 | data: row.data
|
46 | });
|
47 | }
|
48 | for (var i = 0; i < this.selectedIndices.length; i++) {
|
49 | row = this.rows[this.selectedIndices[i]];
|
50 | datas.push({
|
51 | 'id': row.rowId,
|
52 | 'status': row.status,
|
53 | data: row.data
|
54 | });
|
55 | }
|
56 | return datas
|
57 | }
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 | const getSelectRows = function() {
|
68 | var rows = [];
|
69 | for (var i = 0; i < this.selectedIndices.length; i++) {
|
70 | rows.push(this.rows[this.selectedIndices[i]])
|
71 | }
|
72 | return rows
|
73 | }
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 | const getChangedRows = function() {
|
84 | var changedRows = [],
|
85 | rows = this.rows.peek();
|
86 | for (var i = 0, count = rows.length; i < count; i++) {
|
87 | if (rows[i] && rows[i].status != Row.STATUS.NORMAL) {
|
88 | changedRows.push(rows[i])
|
89 | }
|
90 | }
|
91 | return changedRows
|
92 | }
|
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 | const getRowByRowId = function(rowid) {
|
102 | for (var i = 0, count = this.rows.length; i < count; i++) {
|
103 | if (this.rows[i].rowId == rowid)
|
104 | return this.rows[i]
|
105 | }
|
106 | return null
|
107 | }
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 | const getRowValue = function(rowIndex, fieldName) {
|
119 | var row = this.rows[rowIndex]
|
120 | if (row) {
|
121 | return row.data[fieldName]['value']
|
122 | }
|
123 | return null
|
124 | }
|
125 |
|
126 | export const pageGetDataFunObj = {
|
127 | getData: getData,
|
128 | getSelectDatas: getSelectDatas,
|
129 | getSelectRows: getSelectRows,
|
130 | getChangedRows: getChangedRows,
|
131 | getRowByRowId: getRowByRowId,
|
132 | getRowValue: getRowValue
|
133 | }
|