【发布时间】:2013-07-17 10:05:18
【问题描述】:
$(document).live('mouseup', function () {
flag = false;
});
var colIndex;
var lastRow;
$(document).on('mousedown', '.csstablelisttd', function (e) {
//This line gets the index of the first clicked row.
lastRow = $(this).closest("tr")[0].rowIndex;
var rowIndex = $(this).closest("tr").index();
colIndex = $(e.target).closest('td').index();
$(".csstdhighlight").removeClass("csstdhighlight");
if (colIndex == 0 || colIndex == 1) //)0 FOR FULL TIME CELL AND 1 FOR TIME SLOT CELL.
return;
if ($('#contentPlaceHolderMain_tableAppointment tr').eq(rowIndex).find('td').eq(colIndex).hasClass('csstdred') == false) {
$('#contentPlaceHolderMain_tableAppointment tr').eq(rowIndex).find('td').eq(colIndex).addClass('csstdhighlight');
flag = true;
return false;
}
});
我正在拖动表格单元格。 在拖动(向下移动)时,我还必须移动表格滚动。 而且我想反向选择单元格(向上方向)。 我该怎么办。
我已经选择了 tr 类。
【问题讨论】:
-
请参考这个你会得到一些使用jquery拖动表格单元格的想法JQury plugin for table drag and dropdrag and drop table row from on table to another提前谢谢
-
据了解,您希望通过将鼠标拖到行上来选择行,而不是向上或向下拖动行。是这样吗?
标签: javascript jquery html web