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!
-
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.– Boghyon HoffmannNov 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?– VishnukkJan 27, 2020 at 15:45
Add a comment
|
1 Answer
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).