Skip to content

Quick Table Component

Overview

The <quick-table> component provides a simplified way to display tabular data in the Qelos template ecosystem. It wraps the Element Plus table with additional functionality for common use cases like pagination, sorting, and filtering.

Usage

html
<quick-table :data="tableData" :columns="tableColumns"></quick-table>

Props

PropTypeDefaultDescription
dataArray[]Array of objects to display in the table
columnsArray[]Configuration for table columns
loadingBooleanfalseWhether the table is in a loading state
paginationBooleantrueWhether to show pagination
pageSizeNumber10Number of rows per page
pageSizesArray[10, 20, 50, 100]Available page size options
stripeBooleantrueWhether to apply stripe style to rows
borderBooleanfalseWhether to show vertical borders
heightString/Number-Table height, can be a number or CSS value
maxHeightString/Number-Maximum table height
emptyTextString'No Data'Text to display when there is no data

Column Configuration

Each column in the columns array should be an object with the following properties:

javascript
{
  prop: 'fieldName',       // Property name in data objects
  label: 'Display Label',  // Column header text
  width: '120px',          // Column width (optional)
  sortable: true,          // Whether column is sortable (optional)
  formatter: (row) => row.fieldName.toUpperCase(), // Custom formatter function (optional)
  align: 'center',         // Text alignment (left, center, right) (optional)
  fixed: true,             // Whether column is fixed (optional)
  className: 'custom-class' // Custom CSS class for the column (optional)
}

Events

EventParametersDescription
row-click(row, column, event)Emitted when a row is clicked
selection-change(selection)Emitted when selection changes (if selectable)
sort-change(column, prop, order)Emitted when sorting changes
page-change(page)Emitted when current page changes
page-size-change(size)Emitted when page size changes

Slots

SlotDescription
defaultCustom content for the table
emptyCustom content when table is empty
appendContent to append after the last row
[column-prop]Custom cell content for a specific column
[column-prop]-headerCustom header content for a specific column

Examples

Basic Usage

html
<quick-table :data="users" :columns="[
  { prop: 'name', label: 'Name' },
  { prop: 'email', label: 'Email' },
  { prop: 'role', label: 'Role' }
]"></quick-table>

With Custom Column Formatting

html
<quick-table :data="products" :columns="[
  { prop: 'name', label: 'Product Name' },
  { prop: 'price', label: 'Price', formatter: (row) => `$${row.price.toFixed(2)}` },
  { prop: 'status', label: 'Status' }
]"></quick-table>

With Custom Cell Templates

html
<quick-table :data="users" :columns="[
  { prop: 'name', label: 'Name' },
  { prop: 'email', label: 'Email' },
  { prop: 'actions', label: 'Actions', width: '120px' }
]">
  <template #actions="{ row }">
    <el-button size="small" @click="editUser(row)">Edit</el-button>
    <el-button size="small" type="danger" @click="deleteUser(row)">Delete</el-button>
  </template>
</quick-table>

With Pagination and Loading State

html
<quick-table 
  :data="tableData" 
  :columns="tableColumns" 
  :loading="isLoading"
  :pagination="true"
  :page-size="20"
  @page-change="loadPage"
></quick-table>

u00a9 Velocitech LTD. All rights reserved.

Released under the Apache License 2.0.