0
我有一张表,表示一个物理12x8网格。每个<td>
包含网格坐标的文本名称(A1-H12)。我已经添加了jquery-ui selectable与表的交互。我希望用户能够选择任意一组网格坐标。除了选择<td>
s,我希望用户能够通过单击行或列<th>
来选择整个行和/或列。选择由<th>
引起我一些困难:选择jquery-ui可选的列
我的jQuery(只允许我看一下所选择的对象,因为我很不清楚如何做的事情):
$(function(){
$('#selectable').selectable({
filter:'td,th',
selected: function(event, ui){
console.log(event);
console.log(ui);
var s=$(this).find('.ui-selected');
console.log(s);
}
})
});
表看起来是这样的:
<table id='selectable'>
<tr>
<th> </th><!-- empty cell over row labels-->
<th class='colhead'>1</th>
...
<th class='colhead'>12</th>
</tr>
<tr>
<th class='rowhead'>A</th>
<td>A1</td>
...
<td>A12</td>
</tr>
...
<tr>
<th class='rowhead'>H</th>
<td>H1</td>
...
<td>H12</td>
</tr>
</table>