Advanced Features

Angular Data GridRich Select Cell Editor

Enterprise

An alternative to using the browser's select popup for dropdowns inside the grid.

The Rich Select Cell Editor allows users to enter a cell value from a list of provided values by searching or filtering the list.

Enabling Rich Select Cell Editor Copy Link

Edit any cell in the grid below to see the Rich Select Cell Editor.

Enabled with agRichSelectCellEditor and configured with IRichCellEditorParams.

columnDefs: [
    {
        cellEditor: 'agRichSelectCellEditor',
        cellEditorParams: {
            values: ['English', 'Spanish', 'French', 'Portuguese', '(other)'],
        }
        // ...other props
    }
]

Benefits over browser's select are as follows:

  • Uses DOM row virtualisation so very large lists can be displayed.
  • Integrates with the grid perfectly, avoiding glitches seen with the standard select.
  • Uses HTML to render the values: you can provide cell renderers to customise what each value looks like.

Customisation Copy Link

Cell Renderer Copy Link

The cell renderer used within the editor can be customised as shown below:

columnDefs: [
    {
        cellEditor: 'agRichSelectCellEditor',
        cellRenderer: ColourCellRenderer,
        cellEditorParams: {
            values: ['AliceBlue', 'AntiqueWhite', 'Aqua', /* .... many colours */ ],
            cellRenderer: ColourCellRenderer,
            valueListMaxHeight: 220
        }
        // ...other props
    }
]

The interface for the Rich CellEditor Component is as follows:

interface ICellEditorRendererAngularComp {
    // Mandatory - Params for rendering
    agInit(params: IRichCellEditorRendererParams): void;
    }

The Component is provided props containing, amongst other things, the value to be rendered.

class MyCustomEditorRenderer implements ICellEditorRendererAngularComp {
  // ...
  agInit(props: IRichCellEditorRendererParams): void {
    this.value = props.value;
  }
  // ...

The provided props (interface IRichCellEditorRendererParams) are:

cellRendererParamsCopy Link
any
any
TValue[] | TValue | null
The value to be rendered by the renderer
valueFormattedCopy Link
string
The value to be renderer by the renderer formatted by the editor
getValueCopy Link
Function
Gets the current value of the editor
setValueCopy Link
Function
Sets the value of the editor
setTooltipCopy Link
Function
Used to set a tooltip to the renderer
The grid api.
Application context as set on gridOptions.context.

Search Values Copy Link

Different types of search are possible within the editor list as shown below:

columnDefs: [
    {
        cellEditor: 'agRichSelectCellEditor',
        cellRenderer: ColourCellRenderer,
        cellEditorParams: {
            values: ['AliceBlue', 'AntiqueWhite', 'Aqua', /* .... many colours */ ],
            allowTyping: true,
            filterList: true,
            highlightMatch: true,
            valueListMaxHeight: 220
        }
        // ...other props
    }
]

Allow Typing Copy Link

The editor input can be configured to allow text input, which is used to match different parts of the editor list items as shown below:

columnDefs: [
    {
        cellEditor: 'agRichSelectCellEditor',
        cellRenderer: ColourCellRenderer,
        cellEditorParams: {
            values: ['AliceBlue', 'AntiqueWhite', 'Aqua', /* .... many colours */ ],
            allowTyping: true,
            filterList: true,
            highlightMatch: true,
            valueListMaxHeight: 220
        }
        // ...other props
    }
]

Format Values Copy Link

Items in the editor list can be formatted as shown below:

columnDefs: [
    {
        cellEditor: 'agRichSelectCellEditor',
        cellEditorParams: {
            values: ['English', 'Spanish', 'French', 'Portuguese', '(other)'],
            formatValue: value => value.toUpperCase()
        }
        // ...other props
    }
]

Multi Selection Copy Link

The editor can be configured to allow the selection of multiple values as shown below:

columnDefs: [
    {
        cellEditor: 'agRichSelectCellEditor',
        cellEditorParams: {
            values: ['AliceBlue', 'AntiqueWhite', 'Aqua', /* .... many colours */ ],
            multiSelect: true,
            searchType: 'matchAny',
            filterList: true,
            highlightMatch: true,
            valueListMaxHeight: 220
        }
        // ...other props
    }
]

Complex Objects Copy Link

When working with complex objects, a formatValue callback function is required to convert that complex object into a string that can be rendered by the Rich Select Editor. If the Grid Column being edited is not using complex values, or if the Rich Select Editor value object has a different format (different properties) than the object used by the Grid Column, a parseValue callback function is required to convert the editor format into the grid column's format.

When working with Cell Renderers, a formatValue callback should still be provided so it will be possible to use functionality that relies on string values such as allowTyping.

const colors = [
  { name: "Pink", code: "#FFC0CB" },
  // ...other values
];

columnDefs: [
    {
        cellEditor: 'agRichSelectCellEditor',
        valueFormatter: (p) => `${p.value.name} (${p.value.code})`,
        valueParser: (p) => p.newValue,
        cellDataType: 'object',
        cellEditorParams: {
            values: colors,
            formatValue: (v) => v.name,
            allowTyping: true,
            filterList: true,
        }
        // ...other props
    }
]

Async Values Copy Link

Overview Copy Link

List values can be provided asynchronously to the editor as shown below:

function fetchLanguages(_params: RichCellEditorValuesCallbackParams): Promise<string[]> {
  return new Promise((resolve) => {
    setTimeout(() => resolve(['English', 'Spanish', 'French', 'Portuguese', '(other)']), 1000);
  });
}
columnDefs: [
    {
        headerName: 'Language',
        field: 'language',
        cellEditor: 'agRichSelectCellEditor',
        cellEditorParams: {
            values: fetchLanguages,
        }
    }
]

Properties available on the IRichCellEditorParams<TData = any, TValue = any, GValue = any> interface.

The list of values to be selected from. Required when valuesPage is not provided.

Paged Async Values Copy Link

For large datasets, valuesPage avoids loading everything at once.

In paged mode the editor requests row ranges (and optional cursor tokens), rather than a single full list.

Requests always include startRow and endRow. cursor is optional: it is undefined on the first request, then for forward paging it is automatically populated from the previous page result.

You can use valuesPageInitialStartRow to open around the current value while still allowing navigation to earlier and later pages.

function getLanguagesPage(params: RichCellEditorValuesPageParams): Promise<RichCellEditorValuesPageResult<string>> {
    return fetch(
        `/api/languages?startRow=${params.startRow}&endRow=${params.endRow}&cursor=${encodeURIComponent(params.cursor ?? '')}`
    ).then((res) => res.json());
}
columnDefs: [
    {
        headerName: 'Language',
        field: 'language',
        cellEditor: 'agRichSelectCellEditor',
        cellEditorParams: {
            valuesPage: getLanguagesPage,
            valuesPageInitialStartRow: (value) => getRowForSelectedValue(value),
            valuesPageSize: 100,
            valuesPageLoadThreshold: 10
        }
    }
]

Properties available on the IRichCellEditorParams<TData = any, TValue = any, GValue = any> interface.

valuesPageCopy Link
RichCellEditorValuesPageCallback
Optional paged datasource for very large value lists. When provided, values are loaded incrementally and additional pages are requested as the user scrolls. If both values and valuesPage are set, valuesPage takes precedence.
valuesPageInitialStartRowCopy Link
number | RichCellEditorValuesPageStartRowCallback
default: 0
Initial page start row when using valuesPage. Can be a fixed number or a callback that derives the start row from the current editor value. Only applied for the initial, unfiltered load. Filtered searches always start from row 0.
valuesPageSizeCopy Link
number
default: 100
Number of rows requested per page when using valuesPage.
valuesPageLoadThresholdCopy Link
number
default: 10
Number of rows from the end of the loaded list at which the next page is requested.

Async Filtering Copy Link

For advanced filtering scenarios, combine async values callback, allowTyping, and filterListAsync to enable async filtering.

When filterListAsync is set to true, the cell editor behaves as follows:

  • It calls the values callback with the current search term.
  • It delays the search request by 300ms (this can be adjusted using searchDebounceDelay) to avoid excessive calls.
  • A loading indicator appears while the network request is in progress.
  • Once the promise resolves, the dropdown is updated with the filtered results.

This is shown in the example below:

function fetchLanguages(params: RichCellEditorValuesCallbackParams): Promise<string[]> {
    return fetch(`/api/languages?search=${encodeURIComponent(params.search)}`)
        .then(res => res.json())
        .then(data => data.items as string[]);
}
columnDefs: [
    {
        headerName: 'Language',
        field: 'language',
        cellEditor: 'agRichSelectCellEditor',
        cellEditorParams: {
            allowTyping: true,
            filterList: true,
            filterListAsync: true,
            values: fetchLanguages
        }
    }
]

Properties available on the IRichCellEditorParams<TData = any, TValue = any, GValue = any> interface.

The list of values to be selected from. Required when valuesPage is not provided.
filterListAsyncCopy Link
boolean
default: false
Set to true to enable asynchronous filtering of values via the values or valuesPage callback. (only relevant when allowTyping=true and filterList=true).
searchDebounceDelayCopy Link
number
default: 300
The value in ms for the search algorithm debounce delay

Paged Async Filtering Copy Link

For very large, server-backed datasets, combine async filtering with valuesPage so filtered results are also loaded incrementally. valuesPageInitialStartRow is only used for the initial unfiltered load; once the user types, filtered paging starts from row 0.

In this mode each request includes:

  • search for the current filter text.
  • startRow and endRow for range-based pagination.
  • cursor for cursor-based forward pagination APIs (undefined on the first request, then replayed from the previous response).

You can implement either strategy in your datasource:

  • Range-based: use startRow / endRow and return lastRow.
  • Cursor-based: use cursor for forward pages and still tolerate startRow / endRow for initial positioning and upward loading.
function getFilteredLanguagesPage(
    params: RichCellEditorValuesPageParams
): Promise<RichCellEditorValuesPageResult<string>> {
    return fetch(
        `/api/languages?search=${encodeURIComponent(params.search)}&startRow=${params.startRow}&endRow=${params.endRow}&cursor=${encodeURIComponent(params.cursor ?? '')}`
    ).then((res) => res.json());
}
columnDefs: [
    {
        headerName: 'Language',
        field: 'language',
        cellEditor: 'agRichSelectCellEditor',
        cellEditorParams: {
            allowTyping: true,
            filterList: true,
            filterListAsync: true,
            valuesPage: getFilteredLanguagesPage,
            valuesPageInitialStartRow: (value) => getRowForSelectedValue(value),
            valuesPageSize: 100,
            valuesPageLoadThreshold: 10
        }
    }
]

Properties available on the IRichCellEditorParams<TData = any, TValue = any, GValue = any> interface.

valuesPageCopy Link
RichCellEditorValuesPageCallback
Optional paged datasource for very large value lists. When provided, values are loaded incrementally and additional pages are requested as the user scrolls. If both values and valuesPage are set, valuesPage takes precedence.
valuesPageInitialStartRowCopy Link
number | RichCellEditorValuesPageStartRowCallback
default: 0
Initial page start row when using valuesPage. Can be a fixed number or a callback that derives the start row from the current editor value. Only applied for the initial, unfiltered load. Filtered searches always start from row 0.
valuesPageSizeCopy Link
number
default: 100
Number of rows requested per page when using valuesPage.
valuesPageLoadThresholdCopy Link
number
default: 10
Number of rows from the end of the loaded list at which the next page is requested.
filterListAsyncCopy Link
boolean
default: false
Set to true to enable asynchronous filtering of values via the values or valuesPage callback. (only relevant when allowTyping=true and filterList=true).

API Reference Copy Link

Properties available on the IRichCellEditorParams<TData = any, TValue = any, GValue = any> interface.

The list of values to be selected from. Required when valuesPage is not provided.
valuesPageCopy Link
RichCellEditorValuesPageCallback
Optional paged datasource for very large value lists. When provided, values are loaded incrementally and additional pages are requested as the user scrolls. If both values and valuesPage are set, valuesPage takes precedence.
valuesPageInitialStartRowCopy Link
number | RichCellEditorValuesPageStartRowCallback
default: 0
Initial page start row when using valuesPage. Can be a fixed number or a callback that derives the start row from the current editor value. Only applied for the initial, unfiltered load. Filtered searches always start from row 0.
valuesPageSizeCopy Link
number
default: 100
Number of rows requested per page when using valuesPage.
valuesPageLoadThresholdCopy Link
number
default: 10
Number of rows from the end of the loaded list at which the next page is requested.
cellHeightCopy Link
number
The row height, in pixels, of each value.
cellRendererCopy Link
any
The cell renderer to use to render each value. Cell renderers are useful for rendering rich HTML values, or when processing complex data.
cellRendererParamsCopy Link
any
The custom parameters to be used by the cell render.
allowTypingCopy Link
boolean
default: false
Set to true to be able to type values in the display area.
filterListCopy Link
boolean
default: false
If true it will filter the list of values as you type (only relevant when allowTyping=true).
filterListAsyncCopy Link
boolean
default: false
Set to true to enable asynchronous filtering of values via the values or valuesPage callback. (only relevant when allowTyping=true and filterList=true).
searchTypeCopy Link
'match' | 'matchAny' | 'fuzzy'
default: 'fuzzy'
The type of search algorithm that is used when searching for values.
  • match - Matches if the value starts with the text typed.
  • matchAny - Matches if the value contains the text typed.
  • fuzzy - Matches the closest value to text typed.
  • Note: When a cellRenderer is specified, this option will not work.
    highlightMatchCopy Link
    boolean
    default: false
    If true, each item on the list of values will highlight the part of the text that matches the input. Note: It only makes sense to use this option when filterList is true and searchType is not fuzzy.
    multiSelectCopy Link
    boolean
    If true this component will allow multiple items from the list of values to be selected.
    suppressDeselectAllCopy Link
    boolean
    If true the option to remove all selected options will not be displayed. Note: This feature only works when multiSelect=true.
    suppressMultiSelectPillRendererCopy Link
    boolean
    When multiSelect=true the editor will automatically show the selected items as "pills". Set this property to true suppress this behaviour.
    searchDebounceDelayCopy Link
    number
    default: 300
    The value in ms for the search algorithm debounce delay
    valuePlaceholderCopy Link
    string
    A string value to be used when no value has been selected.
    valueListGapCopy Link
    number
    default: 4
    The space in pixels between the value display and the list of items.
    valueListMaxHeightCopy Link
    number | string
    default: 'calc(var(--ag-row-height) * 6.5)'
    The maximum height of the list of items. If the value is a number it will be treated as pixels, otherwise it should be a valid CSS size string.
    valueListMaxWidthCopy Link
    number | string
    The maximum width of the list of items. If the value is a number it will be treated as pixels, otherwise it should be a valid CSS size string. Default: Width of the cell being edited.
    formatValueCopy Link
    Function
    A callback function that allows you to change the displayed value for simple data.
    parseValueCopy Link
    Function
    A callback function that allows you to convert the value of the Rich Select Editor to the data format of the Grid Column when they are different.

    Continue to the next section: Number Cell Editor.