I have been trying to move a particular row to the top of the grid, but unable to find any solution. There is a default feature (Dragging row) available in the grid, which is not needed in this case. I have added a button using cell renderer and clicking to that button, the row should move to the top.
{
headerName: "", field: "move",
cellRenderer: (params) => {
let eGui = document.createElement('div');
let imageElement = document.createElement("img");
imageElement.src = moveTopIcon;
eGui.appendChild(imageElement);
eGui.addEventListener('click', e => {
//code to move the row
});
return eGui;
}
}
Here is the column definition where button is placed.