1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | const getSimpleData = function(options) {
|
25 | options = options || {}
|
26 | var rows, _rowData = [],
|
27 | type = options['type'] || 'all',
|
28 | fields = options['fields'] || null;
|
29 |
|
30 | if (type === 'all') {
|
31 | rows = this.rows.peek();
|
32 | } else if (type === 'current') {
|
33 | var currRow = this.getCurrentRow();
|
34 | rows = currRow == null ? [] : [currRow];
|
35 | } else if (type === 'focus') {
|
36 | var focusRow = this.getFocusRow();
|
37 | rows = focusRow == null ? [] : [focusRow];
|
38 | } else if (type === 'select') {
|
39 | rows = this.getSelectedRows();
|
40 | } else if (type === 'change') {
|
41 | rows = this.getChangedRows();
|
42 | }
|
43 |
|
44 | for (var i = 0; i < rows.length; i++) {
|
45 | _rowData.push(rows[i].getSimpleData({
|
46 | fields: fields
|
47 | }));
|
48 | }
|
49 | if (_rowData.length == 0) {
|
50 | _rowData = this.setSimpleDataReal;
|
51 | }
|
52 | return _rowData;
|
53 | };
|
54 |
|
55 |
|
56 |
|
57 | export const getSimpleDataFunObj = {
|
58 | getSimpleData: getSimpleData
|
59 | }
|