Search code examples
ag-gridag-grid-angular

AG Grid Layout questions


I am trying to let users modify the look and feel of the grid as much as posible. So i implemented a back end where i for now save some of the custom settings per user like which column he like to show or hide. Now i want to be able to also save the folowing.

  1. Column Width ( Is there a way to fire an event which gets me the colid as well as the new size in px or in case the user selected autosize that value is now autosize )

  2. Column Order ( I am looking for an event which is fired once user drags a column to a new spot in grid. I am looking for colid and the new position so i can save the move to my backend)

  3. Save complete layout ( Is there a function i can call to get the complete current layout of the grid so i can save it ?)

Solution

  • Take a look at the grid events ag-Grid docs, which describe several column related events. It should help you with point 1 (columnResized) and point 2 (columnMoved).To get new width on column resized you can use gridOptions.columnApi.getColumnState().

    Point 3 is already answered here.