I have a data grid with 5 items with item names as item-1, item-2, item-3, item-4 and item-5. I want to drag and drop the item-5 to top with in the data grid. And I have to save the order of the newly sorted items. For example, I want to see the items in the data grid like this after sorting. item-5, item-1, item-3, item-2, item-4. And when I query from the database, it should give me the latest sorted order wise. How can I achieve this? Please tell me the all possibilities to achieve this.
Thanks in advance.
I would introduce an attribute for the sorting. And let the DataGrid be sorted by a DS microflow (other means of sorting did not work for me when I tried).
When set-up correctly, the Drag&Drop widget associated to the dragged and the dropped position. You have to use the information to update the sorting attributes in the affected interval (I assume you do not want the dragged/dropped to just switch places, so you have to do the updating). When done, refresh the content.
However, you might run into an issue when trying to sort an entry above the first grid entry, because there will be no drop target. It is a bit fiddly :(