Custom sorting rules

You can specify a sortKey for each column to control the sorting behavior.

For example, the "Date" column can display a formatted date (model's date), while sorting is performed based on the model's underlying timestamp field.

  1. Sort Ascending
  2. Sort Descending
  3. Disable Sorting
Take control of the cursor, clicking on the button or the table
Orders
Loading

0 of 0

import type {BroCol, BroRow} from '@table-bro/core';

interface Order extends BroRow {
  date: string; // the formatted date that the column shows
  timestamp: number; // the date that the column sorts by
}

const cols: BroCol<Order>[] = [
  {
    title: 'Date',
    name: 'date',
    sortKey: 'timestamp'
  }
];

Custom sorting rules with server-side data loading

  1. Load first page from Server
  2. Sort Ascending
  3. Sort Descending
  4. Disable Sorting
Take control of the cursor, clicking on the button or the table
Orders
Loading

0 of 0

import type {BroConfig} from '@table-bro/core';

const config: BroConfig = {
  server: true
};
DJ