Skip to content

Column Configuration

Each column in the DataTable is defined using the Column interface. Below is a detailed explanation of the available column properties.

Example Usage

vue
<script setup>
  const columns = [
    {
      field: 'id',
      title: 'ID',
      type: 'number',
      sort: true,
      isUnique: true
    },
    {
      field: 'name',
      title: 'Name',
      type: 'string',
      filter: true
    },
    {
      field: 'price',
      title: 'Price',
      type: 'number',
      sort: true,
      width: '100px'
    },
    {
      field: 'user.name',
      title: 'User Name',
      type: 'string',
      filter: true
    }
  ];
</script>

<template>
  <AresDataTable
    uniqueId="example-table"
    :columns="columns"
    :isServerMode="false"
  />
</template>

Column Props

PropTypeDefaultDescription
fieldstringThe key in the dataset representing the column’s data. Supports nested fields like user.name or user.country.name.
titlestringThe title of the column displayed in the header.
typeColumnTypenullSpecifies the type of data (e.g., string, number, date). See Column Types.
filter`ColumnFilterboolean`false
htmlbooleanfalseIf true, renders the field as HTML content.
sortbooleanfalseEnables sorting for this column.
isUniquebooleanfalseMarks the field as unique.
showbooleantrueDetermines whether the column is visible in the table.
selectablebooleanfalseAllows selecting the column for mass actions.
cellRenderFunctionnullA custom function to render cell content. Alternatively, use named slots for rendering (see Slots).
classNamestringnullAdds a custom class to the column.
widthstringnullSpecifies a fixed width for the column.
maxWidthstringnullSpecifies the maximum width of the column.

Column Types

The type property defines how data is rendered and affects filtering behavior.

Column TypeDefault Filter TypeDefault ConditionSortingSearchable
NUMBERnumber-inputequal
STRINGstring-inputcontain
BOOLEANselect-booleanequal
DATEdate-pickerequal (or between for date-range)
PICTURE
  • NUMBER – Uses a numeric input field and default equality filtering.
  • STRING – Uses a text input with a default contain filter.
  • BOOLEAN – Uses a boolean select dropdown with equal condition.
  • DATE – Uses a date picker, allowing either exact matching or a date range.
  • PICTURE – Filtering and sorting are disabled for images.

Custom Cell Rendering

You can customize how a cell is rendered using a slot:

vue
<template #user.name="{ value }">
  <a :href="`/users/${value.id}`">{{ value.name }}</a>
</template>

For more details, see the Slots Guide.

Alternatively, you can use the cellRender function:

js
{
  field: 'actions',
  title: 'Actions',
  cellRender: (row) => `<button>Edit ${row.name}</button>`
}

Column Visibility

The show property allows toggling column visibility dynamically:

js
{
  field: 'email',
  title: 'Email',
  show: false // Hidden by default
}

For additional customization options, refer to the Column Filtering Guide.