1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | var getSimpleData = function getSimpleData(options) {
|
25 | options = options || {};
|
26 | var rows,
|
27 | _rowData = [],
|
28 | type = options['type'] || 'all',
|
29 | fields = options['fields'] || null;
|
30 |
|
31 | if (type === 'current') {
|
32 | var currRow = this.getCurrentRow();
|
33 | rows = currRow == null ? [] : [currRow];
|
34 | } else if (type === 'focus') {
|
35 | var focusRow = this.getFocusRow();
|
36 | rows = focusRow == null ? [] : [focusRow];
|
37 | } else {
|
38 | if (this.pageCache) {
|
39 | var pages = this.getPages();
|
40 | rows = [];
|
41 | for (var i = 0; i < pages.length; i++) {
|
42 | var page = pages[i];
|
43 | if (type === 'all') {
|
44 | rows = rows.concat(page.rows.peek());
|
45 | } else if (type === 'select') {
|
46 | rows = rows.concat(page.getSelectRows());
|
47 | } else if (type === 'change') {
|
48 | rows = rows.concat(page.getSelectRows());
|
49 | }
|
50 | }
|
51 | } else {
|
52 | if (type === 'all') {
|
53 | rows = this.rows.peek();
|
54 | } else if (type === 'select') {
|
55 | rows = this.getSelectedRows();
|
56 | } else if (type === 'change') {
|
57 | rows = this.getChangedRows();
|
58 | }
|
59 | }
|
60 | }
|
61 |
|
62 | for (var i = 0; i < rows.length; i++) {
|
63 | _rowData.push(rows[i].getSimpleData({
|
64 | fields: fields
|
65 | }));
|
66 | }
|
67 | if (_rowData.length == 0) {
|
68 | _rowData = this.setSimpleDataReal;
|
69 | }
|
70 | return _rowData;
|
71 | };
|
72 |
|
73 | export var getSimpleDataFunObj = {
|
74 | getSimpleData: getSimpleData
|
75 | }; |
\ | No newline at end of file |