Using a Factory Method to create custom grids with optional differences
The following examples show the use of a Factory Method to create the GridOptions object. The method can be passed some parameters for configuring the options it will return.
The idea here is that you can store a static configuration of the grid to be implemented in all options created by the factory, to avoid having to set those configurations every time you want a new grid.
However, this doesn't leave you with a static grid, as you can still choose which parameters are customizable by passing them into the factory method. The two grids in this example will have the same columnDefs, but are being assigned different rowData and different boolean values for sorting/filtering enabled.