UNPKG

960 BJavaScriptView Raw
1/**
2 * Module : kero dataTable util
3 * Author : liuyk(liuyk@yonyou.com)
4 * Date : 2016-08-08 09:59:01
5 */
6import {isArray} from 'tinper-sparrow/src/util';
7
8const isChanged = function () {
9 var rows = this.getAllRows()
10 for (var i = 0; i < rows.length; i++) {
11 if (rows[i].status != Row.STATUS.NORMAL)
12 return true
13 }
14 return false
15}
16
17const _formatToIndicesArray = function (dataTableObj, indices) {
18 if (typeof indices == 'string' || typeof indices == 'number') {
19 indices = [indices]
20 } else if (indices instanceof Row) {
21 indices = [dataTableObj.getIndexByRowId(indices.rowId)]
22 } else if (isArray(indices) && indices.length > 0 && indices[0] instanceof Row) {
23 for (var i = 0; i < indices.length; i++) {
24 indices[i] = dataTableObj.getIndexByRowId(indices[i].rowId)
25 }
26 }
27 return indices;
28};
29
30export {
31 isChanged,
32 _formatToIndicesArray
33}