我使用的是普通的javascript脚本,无法找到将焦点设置为连续复选框的方法。取消选择多行之一时,焦点保留在刚取消选中的复选框中。当仅剩下一行被选中时,我想将焦点移到该复选框。
这些是我的网格选项: columnDefs:columnDefs, rowSelection:'multiple', rowDeselection:true, rowHeight:26, inhibitorCellSelection:true, onRowSelected:onRowSelected
功能如下:
function onRowSelected(objRow) {
var objFocusedCell = gridOptions.api.getFocusedCell();
var strImageFile = gridOptions.api.getDisplayedRowAtIndex(objFocusedCell.rowIndex).data.ImageFile;
if (gridOptions.rowSelection == 'multiple') {
// I test row selection here because this function may also be used with single row grid option
var arySelectedNodes = gridOptions.api.getSelectedNodes();
var intSelectedCount = gridOptions.api.getSelectedRows().length;
if ((objRow.node.isSelected()) && (intSelectedCount < gridOptions.api.getDisplayedRowCount())) {
if (gridOptions.api.getDisplayedRowAtIndex(objFocusedCell.rowIndex).data.Expires > fncNowString()) {
document.getElementById("theImage").src = gblPath + 'Items/' + strImageFile + "?asof=" + gblAsOf;
} else {
document.getElementById("theImage").src = 'expired.jpg';
}
} else {
doHome();
if (intSelectedCount == 1) {
// CODE TO SET FOCUS WOULD GO HERE
}
}
doBtnEnable('btnSlideshow',(intSelectedCount > 1));
} else {
document.getElementById("theImage").src = gblPath + 'Items/' + strImageFile + "?asof=" + gblAsOf;
}
}