Reputation: 1490
I am working with jquery selectable on one of my tables and I am looking to remove the .selectable
from the element in certain circumstances.
I had found a solution that I could use that worked and that was to add the option of disabled true or false and use that in if and else statements.
$( ".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
});
However there was a downside in the fact that I wanted jquery selectable to be gone so I could interact with the table in other ways.
When I disable the Jquery selectable it does the job of not selecting the tables like I wanted to but it prevents me triggering any events on the table whilst it is disabled.
I figured instead of adding the disabled option that I could remove .selectable
from .standard-table
when I liked and put it back when I liked.
Is this possible? Or is there another way around it?
Upvotes: 0
Views: 895
Reputation: 58422
You can remove selectable using the destroy method:
$( ".standard-table" ).selectable( "destroy" );
Upvotes: 2