【发布时间】:2015-07-24 11:24:25
【问题描述】:
我正在使用在我的一张表上可选择的 jquery,我希望在某些情况下从元素中删除 .selectable。
我找到了一个可行的解决方案,那就是添加禁用 true 或 false 的选项,并在 if 和 else 语句中使用它。
$( ".standard-table").selectable({
filter: "tr",
disabled: false,
scrollSnapX: 5, // When the selection is that pixels near to the top/bottom edges, start to scroll
scrollSnapY: 5, // When the selection is that pixels near to the side edges, start to scroll
scrollAmount: 25, // In pixels
scrollIntervalTime: 100 // In milliseconds
});
但是,我希望 jquery selectable 消失,这样我就可以通过其他方式与表格交互。
当我禁用 Jquery 可选择项时,它不会像我想要的那样选择表,但它会阻止我在禁用时触发表上的任何事件。
我认为与其添加禁用选项,不如在我喜欢时从.standard-table 中删除.selectable,并在我喜欢时将其放回。
这可能吗?还是有别的办法?
【问题讨论】:
标签: jquery jquery-ui-selectable