JQuery UI sortable: restore position based on some condition

前端 未结 3 1088
执念已碎
执念已碎 2020-12-14 11:57

I call sortable.stop() to make an ajax call to store some data after drag & drop operation.

When the ajax call returns an error (application logic e

3条回答
  •  醉话见心
    2020-12-14 12:55

    Have a look at .sortable('cancel'); something like this:

    var list = $('#some-list')
    list.sortable(
    {
        // Some options.
        stop: function()
        {
            $.post('some-url', someData, function()
            {
                if (somethingWentWrong)
                {
                    list.sortable('cancel');
                }
            });
        }
    });
    

提交回复
热议问题