kdtEntrys.getSelectManager().getActiveRowIndex();
EAS KDTable 表格行获取激活的行索引,如果当前表格没有激活的索引 kdtEntrys.getSelectManager().getActiveRowIndex()返回-1。当表格中有数据行选中时。 kdtEntrys.getSelectManager().getActiveRowIndex()都会返回对应的行号。
KDTableUtil.getSelectedRow(table),也是返回当前选择行中的数据索引,但是这个方法有个缺点。选择表头数据,返回的行索引是0。而不是-1;
因此判断表格中是否有行选中时。使用下面的代码
int activeRowIndex = kdtEntrys.getSelectManager().getActiveRowIndex();
if(activeRowIndex==-1){
MsgBox.showInfo("请在检验明细中选择一条分录");
SysUtil.abort();
}