UNPKG

kero

Version:
62 lines (54 loc) 1.48 kB
/** * Module : kero dataTable page getData * Author : liuyk(liuyk@yonyou.com) * Date : 2016-08-08 09:59:01 */ const getData = function () { var datas = [], row, meta; meta = this.parent.getMeta() for (var i = 0; i < this.rows.length; i++) { row = this.rows[i]; datas.push({'id': row.rowId, 'status': row.status, data: row.data}); } return datas } const getSelectDatas = function () { var datas = [], row; for (var i = 0; i < this.rows.length; i++) { row = this.rows[i]; datas.push({'id': row.rowId, 'status': row.status, data: row.data}); } for (var i = 0; i < this.selectedIndices.length; i++) { row = this.rows[this.selectedIndices[i]]; datas.push({'id': row.rowId, 'status': row.status, data: row.data}); } return datas } const getSelectRows = function () { var rows = []; for (var i = 0; i < this.selectedIndices.length; i++) { rows.push(this.rows[this.selectedIndices[i]]) } return rows } const getRowByRowId = function (rowid) { for (var i = 0, count = this.rows.length; i < count; i++) { if (this.rows.rowId == rowid) return this.rows[i] } return null } const getRowValue = function (rowIndex, fieldName) { var row = this.rows[rowIndex] if (row) { return row.data[fieldName]['value'] } return null } export { getData, getSelectDatas, getSelectRows, getRowByRowId, getRowValue }