sortable add alert


Topic: sortable add alert

Escuadra asked 5 years ago

Expected behavior

Actual behavior

Resources (screenshots, code snippets etc.) I need to add a alert when i move something in the list


MDBootstrap staff pro premium priority answered 5 years ago

Hi Escuadra,

In jquery-ui.js file that this plugin contains you can find defined callbacks:

These are default values:

    // Callbacks
    activate: null,
    beforeStop: null,
    change: null,
    deactivate: null,
    out: null,
    over: null,
    receive: null,
    remove: null,
    sort: null,
    start: null,
    stop: null,
    update: null

If you need additional help I am here for you.

Best Regards, Piotr


Escuadra commented 5 years ago

How can I put a function or an alert in that section? would you mind giving an example


MDBootstrap staff pro premium priority answered 5 years ago

Hi,

This example should serve your needs:

$(function () {
  $("#sortable").sortable({
    change: function(event, ui) {
      alert('Updated!');
    }
  });
});

Best Regards, Piotr


Escuadra commented 5 years ago

ok , now i want a confirm . if you say yes it moves but if you say no , it does not move


MDBootstrap staff pro premium priority commented 5 years ago

We did not build such functionality by default. You need to use change callback to revert change or accept change. This functionality can be built on top of our functionality using this component but you need to customize the behaviour of this component by your code.


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.8.5
  • Device: web
  • Browser: chrome
  • OS: mac
  • Provided sample code: No
  • Provided link: No
Tags