0

I would like to make my sap.m.Table manually sortable, so I can sort the rows of my table by drag and drop. I have tried using the jQueryUI sortable() method (it works on lists!), but if I use it on the table it makes the whole table draggable and if I use it on a ColumnListItem I can sort the content of the ColumnListItem, but not the ColumnListItems listed in the table. Does anybody have an idea what else I could try? Or maybe even have a solution to my problem? I am thankful for all the help I can get!

2
  • As of UI5 version 1.54, drag and drop is now supported out of the box. Take a look at this example. In the second table, you can sort items just by dragging. Nov 16, 2017 at 10:36
  • For sorting on a single table with multiple item pages using drag and drop, Is there a way that I can hover with a drag item on the pagination button and it takes me to the 2nd items page and I can sort it there?
    – Vishnukk
    Jan 27, 2020 at 15:45

1 Answer 1

0

Your problem is that you only want to make the table rows (<tr>) draggable. Therefore you need to pass the parent element to jQuery.sortable. Try something like this in your controller:

this.getView().$().find(".sapMList.myClass tbody").sortable();

Whereas myClass is a style class you added to your control (so that only THIS table instance will be affected).

1
  • Thanks! It worked for me with $('.sortable tbody').sortable();
    – N. Stutz
    May 17, 2016 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.