How to rowReorder or delete a row in Datatable


Topic: How to rowReorder or delete a row in Datatable

Pelle Widell pro premium priority asked 4 years ago

Expected behavior

For Table Editable you have a reorder function but just up/down

Actual behavior

I want to be able to reorder tablerows with a drag-icon, like some other. It's ok if this is an PRO feature but to rearrange multiple steps is timeconsuming if you only can sort one step at the time

Resources (screenshots, code snippets etc.)


Marcin Luczak staff answered 4 years ago

Hi Pelle Widell,

Table Editor doesn't support draggable functionality itself, however, you can use Sortable https://mdbootstrap.com/plugins/jquery/sortable/ to achieve this. Just add id to your <tbody> tag on which you will initialize Sortable via jQuery method. In the example I've created for you I've added cursor changing classes to each table element to indicate the possibility to drag the element. I've also provided an option to show a placeholder background for moving items. Please see my snippet below:

https://mdbootstrap.com/snippets/jquery/marcin-luczak/2664091

Best regards, Marcin


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: Pro
  • Premium support: Yes
  • Technology: MDB jQuery
  • MDB Version: 4.19.1
  • Device: all
  • Browser: Chrome
  • OS: Win 10
  • Provided sample code: No
  • Provided link: Yes