Reputation: 77
I'm jsut looking into changing the drag hover of the aggrid component. i cant find much on it... Anyone knows how to change the styles of the row in drag mode?
My goal is to have a different animation (full row) like material UI/UX
https://material.io/design/components/lists.html#behavior
Upvotes: 2
Views: 628
Reputation: 69
It would be possible to replace the created ghost by:
Hide ghost on mouse over and mouse out:
function onCellMouseOver(event) {
document.body.classList.add('cellDragRendererOn');
}
function onCellMouseOut(){
document.body.classList.remove('cellDragRendererOn');
}
gridOptions.onCellMouseOver = onCellMouseOver;
gridOptions.onCellMouseOut = onCellMouseOut;
Replace ghost and styling, and unhide ghost:
function onRowDragEnter() {
var ghost = document.querySelector('.ag-dnd-ghost');
ghost.style.background = 'red';
ghost.innerHTML = '<span class="myClass">My message</span>';
document.body.classList.remove('cellDragRendererOn');
}
gridOptions.onRowDragEnter = onRowDragEnter;
The body -> ghost CSS styling:
.cellDragRendererOn .ag-dnd-ghost{
display: none !important;
}
Upvotes: 0
Reputation: 5113
So, actually, there is no possibility for now to modify 'ghost' template, you can try to explore deeper than I did, here is an entry point: ag-grid\src\ts\dragAndDrop\dragAndDropService.ts
and createGhost
method - exactly what you need. One thing that you can do is to override this place just for yourself and use instead of the original library.
Upvotes: 3