kero
Version:
<img src="http://tinper.org/assets/images/kero.png" width="120" style="max-width:100%;"/>
45 lines (41 loc) • 1.01 kB
JavaScript
/**
* Module : kero DataTable getCurrent
* Author : liuyk(liuyk@yonyou.com)
* Date : 2016-08-08 09:59:01
*/
/**
* 获取DataTable对象的当前行
* @memberof DataTable
* @return {null|u.Row} DataTable对象的当前行
* @example
* datatable.getCurrentRow()
*/
const getCurrentRow = function() {
if (this.focusIndex() != -1)
return this.getFocusRow()
var index = this.getSelectedIndex()
if (index == -1)
return null
else
return this.getRow(index)
}
/**
* 获取DataTable对象的当前行对应的index
* @memberof DataTable
* @return {number} DataTable对象的当前行对应的index
* @example
* datatable.getCurrentIndex()
*/
const getCurrentIndex = function() {
if (this.focusIndex() != -1)
return this.focusIndex()
var index = this.getSelectedIndex()
if (index == -1)
return -1
else
return index
}
export const getCurrentFunObj = {
getCurrentRow: getCurrentRow,
getCurrentIndex: getCurrentIndex
}