Skip to content
OGE logoOGE

Migrate from AG Grid

The OGE grid covers what an AG Grid screen usually uses — sorting, filtering, grouping with summaries, selection, editing, pinned rows and columns, master-detail, export — with one difference in shape: server data goes through a data source that receives a single LoadOptions object instead of a row-model callback.

grid options columnDefs server-side rows

Grid options

AG Grid grid options on oge-grid
AG GridOGE grid
rowDatadata (an array or a DataSource )
getRowIdkeyField
columnDefs<oge-column> children or columns
defaultColDef column defaults are sensible: sortable, filterable, resizable with columnResize
pagination · paginationPageSizepaging: { pageSize }
rowSelectionselectionMode: 'single' | 'multiple' (+ selectedKeys )
cellSelection (range selection) rangeSelection with selectionMode: 'cell'
rowModelType: 'serverSide' / 'infinite' a CustomDataSource ; scrolling: { mode: 'infinite' } for block loading
rowGroupPanelShowgroupPanel
rowGroup on a column groupIndex on the column (or groupBy )
aggFuncgroupSummary / totalSummary on the column
floatingFilterfilterRow
set filter ( agSetColumnFilter ) headerFilter (value list, conditions, or both)
quick filter ( quickFilterText ) searchPanel
rowDragManaged · rowDragEntireRowrowDragging ( rowDragGroup across grids, rowDragExternal to other apps)
masterDetail · detailCellRenderer a detail template ( *ogeDetailTemplate )
pinnedTopRowData · pinnedBottomRowDatapinnedTopRows · pinnedBottomRows
enableRtlrtlEnabled
exportDataAsExcel / exportDataAsCsvexportGridToExcel() ( @oge-ui/grid/export-excel ) · getCsv()

Column definitions

AG Grid column definitions on oge-column
AG Grid ColDefOGE column
fieldfield
headerNamecaption
width · minWidth · maxWidthwidth · minWidth · maxWidth
hidevisible: false
pinnedpinned: 'left' | 'right'
sortable: false · filter: falsesortable: false · filterable: false
sort · sortIndexsortOrder · sortIndex
valueGettercalculateCellValue
valueFormatterformat (a function or a declarative OgeValueFormat )
comparatorcalculateSortValue , or sorting.compare for the whole grid
cellRenderer*ogeCellTemplate
headerComponent*ogeHeaderTemplate
editable · cellEditoreditable · *ogeEditTemplate ( editing on the grid)
cellClassRulesconditionalFormats or the grid's cellClass
children (column groups) <oge-column-group>
// AG Grid: columnDefs objects
columnDefs: ColDef<Order>[] = [
  { field: 'id', headerName: 'Id', width: 80, pinned: 'left' },
  { field: 'customer', filter: true, sortable: true },
  { headerName: 'Total', valueGetter: (p) => p.data!.qty * p.data!.price,
    valueFormatter: (p) => money(p.value) },
];

<!-- OGE: <oge-column> children (or the same objects through [columns]) -->
<oge-grid [data]="orders" keyField="id" [filterRow]="true">
  <oge-column field="id" caption="Id" [width]="80" pinned="left" />
  <oge-column field="customer" />
  <oge-column caption="Total" [calculateCellValue]="total" [format]="money" />
</oge-grid>

Server data

One request carries paging, sorting, the filter tree, grouping and the summaries; value lists ask distinct(). The filter contract says what each operator means, with test vectors your server can run.

// AG Grid: the server-side row model calls getRows({ request }) with
// startRow / endRow / sortModel / filterModel
// OGE: a data source receives one LoadOptions object — the same in memory and on the server
const orders = new CustomDataSource<Order>({
  key: 'id',
  load: (options) => api.post('/orders/query', options), // skip, take, sort, filter, group, summaries
  distinct: (field, options) => api.post(`/orders/distinct/${field}`, options),
});

Cell renderers

// AG Grid: a cell renderer component registered per column
{ field: 'status', cellRenderer: StatusBadge }

<!-- OGE: a template, with the row and value in context -->
<oge-column field="status">
  <span *ogeCellTemplate="let value" class="status" [attr.data-status]="value">
    {{ value }}
  </span>
</oge-column>

State and the grid API

Column state, filter model and sort model are one GridStateSnapshot; stateKey persists it and stateMigrations upgrades older saved formats.

// AG Grid: gridApi.setFilterModel / getColumnState / applyColumnState
this.gridApi.setFilterModel({ customer: { type: 'contains', filter: 'kaya' } });
const saved = this.gridApi.getColumnState();

// OGE: one serializable snapshot for sort, filters, grouping and the column layout
const saved = this.grid().state();
this.grid().applyState(saved);
// or persist automatically: <oge-grid stateKey="orders" />