22
NovZhi Xiong introduced Vue-table-dynamic which is a vue component of a dynamic table. It’s designed to respond to data changes in real-time and is oriented to the runtime. It has many customizable options and is very easy to use. It has many features like sorting, filtering, editing, pagination, multiple selections, etc.
npm install vue-table-dynamic --save
You can install this package via Npm, Just run this command.
import VueTableDynamic from 'vue-table-dynamic'
Global registration
Vue.use(VueTableDynamic)
Local registration
<script>
export default {
components: { VueTableDynamic }
}
</script>
Basic Table
<template>
<div class="base-demo" style="width: 400px">
<vue-table-dynamic :params="params"></vue-table-dynamic>
</div>
</template>
<script>
import VueTableDynamic from 'vue-table-dynamic'
export default {
name: 'Demo',
data() {
return {
params: {
data: [
['Cell-1', 'Cell-2', 'Cell-3'],
['Cell-4', 'Cell-5', 'Cell-6'],
['Cell-7', 'Cell-8', 'Cell-9']
]
}
}
},
components: { VueTableDynamic }
}
</script>
Bordered table usage
border:true
with borderborder:false
without borderStriped rows
stripe:true
stripedstripe:false
unstripedHighlighted rows/columns/cells
highlight:{row?:Array; column?:Array; cell?:Array<[number,number]>;}
configure highlighted rows, columns, cells. such as: {row: [1], column: [1], cell: [[-1, -1]]}
if negative, the position from the end of the array.highlightedColor:string
configure highlighted colorsSelect multiple rows
showCheck:boolean
show checkbox of rowsgetCheckedRowDatas:function
get data for all currently selected rowssetAllRowChecked:function(selected:boolean)
toggle all selectionselect:event
currently selected/unselected rowsFilter rows by keyword
enableSearch:boolean
enable/disable searchingsearch:function(value:string, included:array, excluded:array)
manual row filteringSort rows based on specified column data
sort:Array
array members are sortable column indexes. such as: [0, 1]
Filter rows based on specified column data and rule
filter:Array<{column:number; content:Array<{text:string; value:string|number;}>; method:function;}>
specify filterable columns and rules. such as: [{column: 0, content: [{text: ‘> 2’, value: 2}], method: (value, cell) => { return cell.data > value }}]
filter[].column:
column indexfilter[].content:
filter itemsfilter[].method:
filter rule.Table with pagination
pagination:boolean
enable/disable paginationpageSize?:number
row count of each page. default: 10pageSizes?:Array
options of row count per page. default: - [10, 20, 50, 100]
Editable table
Support specifying rows/columns/cells for editing
edit:{row?:Array; column?:Array; cell?:Array<[number,number]>;}
configure editable rows, columns, cells. such as: {row: [1], column: [1], cell: [[-1, -1]]}
. if negative, the position from the end of the array.getData:function()
table data changed after editing, get the latest data by this method.cell-change:event
cell data changed eventedit:{row: ‘all’}
all cells can be editedheader
is ‘row’
, the first row is not editablenumber
, only acceptable when entering numbersThis package has a lot more features with many code examples. If you want to learn more about this package you can visit its detailed documentation on Github.
Published at : 22-11-2021
I am a highly results-driven professional with 12+ years of collective experience in the grounds of web application development especially in laravel, native android application development in java, and desktop application development in the dot net framework. Now managing a team of expert developers at Codebrisk.
Launch project