Jax*_*Jax 5 html javascript jquery jquery-ui
我有一个表,我的主体使用jQuery UI的Sortable函数进行了排序.在这个可排序表中,我有一个textarea,允许用户输入有关给定表条目的注释.
<table id="status">
<thead>
<tr>
<th>Name</th>
<th>Comment</th>
</tr>
</thead>
<tbody>
<tr>
<td class="dragHandle">Jason</td>
<td><textarea class="commentBox"></textarea></td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
并使javascript使表可排序(使用辅助函数使表格可排序,我在网上找到)
// Return a helper with preserved width of cells
var fixHelper = function(e, ui) {
ui.children().each(function() {
$(this).width($(this).width());
});
return ui;
};
$("#status").sortable({
helper: fixHelper,
axis: 'y',
handle: '.dragHandle'
}).disableSelection();
Run Code Online (Sandbox Code Playgroud)
文本输入到这个textarea工作正常,但是当我尝试在textarea中选择文本时,没有任何反应.即使使用Shift +箭头键也不像我期望的那样.
如何使textarea的文本可选,同时仍然可以对整个表进行排序?
已经尝试过:
当textarea获得焦点以尝试暂时允许可选择性时,在桌面上执行可排序的"销毁",但即使在销毁之后,文本选择仍然是不稳定的.
设置sortable的'handle'属性,使Name字段只能排序
设置sortable的'disable'属性,以便在从textareas启动时禁用
捕获textarea(或包含textarea的div)中的mousedown/mouseup事件并调用event.stopPropagation()
What's the reasoning for using disableSelection? That is the reason your textArea is not getting focus.
| 归档时间: |
|
| 查看次数: |
3006 次 |
| 最近记录: |