Dear Syncfusion Team,
I would like to be able to lock the x axis when dragging a row to re-order the table. Here is an example of the desired result using the Angular Material Table Library.
Query 1 :
How can I achieve the same result using your grid component?
Query 2 :
How can I make the row drag element not shrink, but make it take the entire width keeping the same row style?
Currently when triggering a drag event, the draggable element looks like this :
I want it to look like this :
Thank you,
Remy
|
// Grid’s created event handler
onCreated() {
this.gridObj.rowDragAndDropModule.draggable.axis = 'y';
} |
|
// Grid’s rowDrag event handler
onRowDrag(args) {
let draggedClone = (this.gridObj.rowDragAndDropModule as any).startedRow;
let targetRow = (this.gridObj.rowDragAndDropModule as any).rows[0];
// Dragged clone element’s children nodes
let draggedChildNodes = draggedClone.childNodes;
// Target row element’s children nodes
let targetChildNodes = targetRow.childNodes;
targetChildNodes.forEach( (ele, index) => {
// Target child node position is retrieved
let posStyle = ele.getBoundingClientRect();
// Target child node’s width and height is set as the dragged child node’s width and height
draggedChildNodes[index].style.width = posStyle.width.toString() + "px";
draggedChildNodes[index].style.height = posStyle.height.toString() + "px";
})
} |
Hi Sujith,
Thanks, that worked great. However I am still wondering how I can have the items moving around as I drag a row instead of only showing a line indicating the "targeted drop row". Is there a way to achieve this? Here is an example of the desired effect when dragging a row (the other rows move to make room for the dragged row, even before dropping it).
Thank you
Remy
Hi Sujith,
Sorry about that. Here is a representation of what I am seeking.
In short, as I drag a row, the other rows move (with animations) to make room for the row being dragged, hence giving a better visualization to the user of where exactly the row will be positioned in the grid after being dropped.
Regards,
R