Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: sortable add alert

Escuadra free 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 answered 5 years ago


Hi,

This example should serve your needs:

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

Best Regards, Piotr


Escuadra free 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 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.


MDBootstrap staff 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 free commented 5 years ago

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



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

  • ForumUser: 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