You can easily use this dynamic action on Reports as well. The thing to note is that you will need to re-initialize the drag and drop setup when the report data changes - such as on refresh, pagination, sorting (as you can see in both examples when you sort or filter)
Classic Report
Note: listen to the "UC Drag & Drop - Sequence Update" event to identify the changes that occur. You can reference this.data and process the sorting sequence changes on the server using APEX_JSON or using native JSON if your database version supports it. In the example above you will see the page item value being set with the following Javascript expression when rows are dragged & dropped.
JSON.stringify(this.data,undefined, 2)
Interactive Report
Interactive Report Example
7839 | KING | PRESIDENT | - | 11/17/1981 | 1800 | 10 | - | - |
7698 | BLAKE | MANAGER | 7839 | 5/1/1981 | 2300 | 30 | - | - |
7782 | CLARK | MANAGER | 7839 | 6/9/1981 | 2000 | 10 | - | - |
7566 | JONES | MANAGER | 7839 | 4/2/1981 | 1800 | 20 | - | - |
7788 | SCOTT | ANALYST | 7566 | 4/19/1987 | 1400 | 20 | - | - |
Note: listen to the "UC Drag & Drop - Sequence Update" event to identify the changes that occur. You can reference this.data and process the sorting sequence changes on the server using APEX_JSON or using native JSON if your database version supports it. In the example above you will see the page item value being set with the following Javascript expression when rows are dragged & dropped.
JSON.stringify(this.data,undefined, 2)
There are three important configuration settings to mention which are very useful when working with different types of regions: groupSelector, itemSelector and handle:
- groupSelector - Defines the parent/ancestor element which contains/houses your draggable elements. This must be a selector (class name, id) of an element in your region. E.g. in the Interactive Report's example it is set to tbody.
- itemSelector - Defines the draggable elements' selector inside your region. The elements must be descendants of the element defined by the groupSelector. E.g. in the Interactive Report's example it is set to tr:not(:first-child). This selector queries relatively to the group element (defined by groupSelector).
- handle - In case you wish to utilize a handle element by which you can drag, you need to provide a selector for it as well. You can see an example of this handle in the Classic Report example. This selector queries relatively to the draggable element (defined by itemSelector).
To recap: define a group element in your region by setting groupSelector, this group will then be queried by the itemSelector to get the draggable items and if you are using handle, the draggable items will be queried to get the handle-elements.