Vue EasyTable
Vue EasyTable is a robust data table component specifically designed for Vue 2.x applications, offering a comprehensive suite of features for displaying and interacting with tabular data. It supports virtual scrolling, allowing it to efficiently render up to 300,000 rows, along with functionalities such as column fixing, header grouping, filtering, sorting, column resizing, and in-cell editing. The current stable version is 2.27.1, with a release cadence that includes regular minor feature additions (like new languages) and bug fixes. Key differentiators include its focus on high performance with large datasets, extensive customization options for cell and header rendering, and built-in internationalization and theme support. It requires `vue` (>=2.6.0) and `lodash` as peer dependencies, making it suitable for existing Vue 2 projects that need a feature-rich, performant table solution.
Common errors
-
Unknown custom element: <ve-table> - did you register the component correctly?
cause The VeTable component was used in a Vue template but not registered with the Vue instance or parent component.fixEnsure `VeTable` is imported and added to the `components` option of your Vue component or globally registered using `Vue.component('ve-table', VeTable)`. -
Resizer column needs set column width
cause This is a console warning indicating that column resizing functionality is active, but some columns do not have an explicit `width` property defined, which can lead to unpredictable resizing behavior.fixFor columns where resizing is enabled or desired, ensure you explicitly set a `width` property in your column definitions (e.g., `{ field: 'name', key: 'b', title: 'Name', width: 150 }`).
Warnings
- breaking The sorting click area for table headers has changed from only the sort icon to the entire `<th>` element.
- breaking A context menu type name for header operations has been renamed from `CANCLE_LEFT_FIXED_COLUMN_TO` to `CANCEL_LEFT_FIXED_COLUMN_TO`.
- gotcha This library is exclusively built for Vue 2.x. It does not support Vue 3, and attempting to use it in a Vue 3 project will result in runtime errors.
- gotcha The `lodash` package is a required peer dependency. Although it might work without it in some cases, certain features or internal operations depend on its presence.
Install
-
npm install vue-easytable -
yarn add vue-easytable -
pnpm add vue-easytable
Imports
- VeTable
const VeTable = require('vue-easytable')import { VeTable } from 'vue-easytable' - CSS Styles
import 'vue-easytable/libs/themes-base/index.css'
- VeLocale
import { VeLocale } from 'vue-easytable'; import zhCN from 'vue-easytable/libs/locale/lang/zh-CN'
Quickstart
import Vue from 'vue';
import { VeTable } from 'vue-easytable';
import 'vue-easytable/libs/themes-base/index.css';
new Vue({
el: '#app',
components: { VeTable },
data() {
return {
columns: [
{ field: 'id', key: 'a', title: 'ID', align: 'center' },
{ field: 'name', key: 'b', title: 'Name', align: 'left' },
{ field: 'date', key: 'c', title: 'Date', align: 'right' }
],
tableData: [
{ id: 1, name: 'John Doe', date: '2023-01-01' },
{ id: 2, name: 'Jane Smith', date: '2023-01-02' },
{ id: 3, name: 'Robert Johnson', date: '2023-01-03' }
]
};
},
template: `
<div id="app">
<h3>Basic Vue EasyTable Example</h3>
<ve-table
:columns="columns"
:table-data="tableData"
/>
</div>
`
});