UNPKG

1.21 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6/**
7 * Module : kero dataTable getSimpleData
8 * Author : liuyk(liuyk@yonyou.com)
9 * Date : 2016-08-01 14:34:01
10 */
11
12/**
13 * 获取数据,只取字段名与字段值
14 */
15var getSimpleData = function getSimpleData(options) {
16 options = options || {};
17 var rows,
18 _rowData = [],
19 type = options['type'] || 'all',
20 fields = options['fields'] || null;
21
22 if (type === 'all') {
23 rows = this.rows.peek();
24 } else if (type === 'current') {
25 var currRow = this.getCurrentRow();
26 rows = currRow == null ? [] : [currRow];
27 } else if (type === 'focus') {
28 var focusRow = this.getFocusRow();
29 rows = focusRow == null ? [] : [focusRow];
30 } else if (type === 'select') {
31 rows = this.getSelectedRows();
32 } else if (type === 'change') {
33 rows = this.getChangedRows();
34 }
35
36 for (var i = 0; i < rows.length; i++) {
37 _rowData.push(rows[i].getSimpleData({ fields: fields }));
38 }
39 if (_rowData.length == 0) {
40 _rowData = this.setSimpleDataReal; //云采提的#需求
41 }
42 return _rowData;
43};
44
45exports.getSimpleData = getSimpleData;
\No newline at end of file