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 === 'current') {
|
31 | var currRow = this.getCurrentRow();
|
32 | rows = currRow == null ? [] : [currRow];
|
33 | } else if (type === 'focus') {
|
34 | var focusRow = this.getFocusRow();
|
35 | rows = focusRow == null ? [] : [focusRow];
|
36 | } else {
|
37 | if (this.pageCache) {
|
38 | var pages = this.getPages();
|
39 | rows = []
|
40 | for (var i = 0; i < pages.length; i++) {
|
41 | var page = pages[i];
|
42 | if (type === 'all') {
|
43 | rows = rows.concat(page.rows.peek());
|
44 | }else if(type === 'select') {
|
45 | rows = rows.concat(page.getSelectRows());
|
46 | } else if (type === 'change') {
|
47 | rows = rows.concat(page.getSelectRows());
|
48 | }
|
49 | }
|
50 | } else {
|
51 | if (type === 'all') {
|
52 | rows = this.rows.peek();
|
53 | } else if (type === 'select') {
|
54 | rows = this.getSelectedRows();
|
55 | } else if (type === 'change') {
|
56 | rows = this.getChangedRows();
|
57 | }
|
58 | }
|
59 | }
|
60 |
|
61 | for (var i = 0; i < rows.length; i++) {
|
62 | _rowData.push(rows[i].getSimpleData({
|
63 | fields: fields
|
64 | }));
|
65 | }
|
66 | if (_rowData.length == 0) {
|
67 | _rowData = this.setSimpleDataReal;
|
68 | }
|
69 | return _rowData;
|
70 | };
|
71 |
|
72 |
|
73 |
|
74 | export const getSimpleDataFunObj = {
|
75 | getSimpleData: getSimpleData
|
76 | }
|