UNPKG

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