Column configuration
Sorting

Sorting Configuration

Enable sorting for the specified column.

  const config: BeastGridConfig<User> = {
    data,
    columnDefs,
    defaultColumnDef,
    border: true,
  };
  const columnDefs: ColumnDef[] = [
    { headerName: 'ID', field: 'userId', sortable: false },
    { headerName: 'NAME', field: 'username', sortable: false },
    {
      headerName: 'AMOUNT',
      field: 'money',
      width: 100,
      formatter: (value) => numeral(value).format('0,0 $'),
    },
    {
      headerName: 'ORDERS',
      field: 'orders',
      formatter: (value) => numeral(value).format('0,0'),
    },
  ];

In the above example, the first two columns are not sortable, while the last two columns are sortable.

You can acces the sorting state using our API