Reputation: 11
I want to remove an item from a jQuery-UI sortable list on the receive event. I'm trying something this:
receive: function(event, ui){
num_of_items = num_of_items+1;
if(num_of_items >= 3)
{
ui.item.remove();
num_of_items = num_of_items -1;
}
}
This renders the error:
Uncaught TypeError: Cannot read property 'options' of undefined
The item.remove() seems to work fine on any other event, such as beforeStop, stop etc.
Upvotes: 0
Views: 1072
Reputation: 56
Remove an item on receive callback isn't a good idea because it can be used for other callbacks. But you can make it no more sortable. Here's my advice :
Hope it will suit you !
Upvotes: 1