我要檢查,如果當前網格單元是行中的最後一個可見細胞。檢查TD是最後一個可見TD
//accurately confirms if cell is the last cell in the row, assuming there are no "display: none" cells after it
var isLastColumn = $(e.target).closest('td').is(':last-child');
//doesn't work - obviously because last-child gets the cell regardless of visiility
var isLastColumn = $(e.target).closest('td').is(':visible:last-child');
//doesn't work
var isLastColumn = $(e.target).closest('td').is('td.visible:last-of-type');
//doesn't work
var isLastColumn = $(e.target).closest('td').is(':visible:last');
我如何檢查,看看是否所選小區是行的最後可見列?
我掛鉤到事件有以下幾點:
var grid = $("#@gridName").data("kendoGrid");
grid.tbody.on('keydown', onGridKeydown)
function onGridKeydown(e)
{
var isLastColumn = $(e.target).closest('td').is(':last-child');
}
請定義 '可見的' 的意思。你是說所有其他的都隱藏在DOM中,或者是不可見的,因爲它們低於'window'的範圍? –
@RoryMcCrossan我只是指沒有特殊修飾符或類的單元格,即td的默認可見性。隱形TD只是有「顯示:無」設置 – TruthOf42
有問題的電池應該是在窗口,當然還有DOM – TruthOf42