All Projects → mikemenaker → vue-data-table

mikemenaker / vue-data-table

Licence: MIT license
Smart table using vue.js - sorting columns, filter by string, child rows, custom columns, custom row data

Programming Languages

Vue
7211 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to vue-data-table

Datatablesbundle
This Bundle integrates the jQuery DataTables plugin into your Symfony application.
Stars: ✭ 334 (+2126.67%)
Mutual labels:  datatables, table
Svelte Simple Datatables
A Datatable component for Svelte
Stars: ✭ 56 (+273.33%)
Mutual labels:  datatables, table
Ce
Jspreadsheet is a lightweight vanilla javascript plugin to create amazing web-based interactive tables and spreadsheets compatible with other spreadsheet software.
Stars: ✭ 5,832 (+38780%)
Mutual labels:  datatables, table
Vue Ui For Pc
基于Vue2.x的一套PC端UI组件,包括了Carousel 跑马灯、Cascader 级联、Checkbox 多选框、Collapse 折叠面板、DatePicker 日期选择、Dialog 对话框、Form 表单、Input 输入框、InputNumber 数字输入框、Layer 弹窗层、Loading 加载、Menu 菜单、Page 分页、Progress 进度条、Radio 单选框、SelectDropDown 仿select、Switch 开关、Table 表格、Tabs 标签页、Textarea 文本框、Tooltip 文字提示、BackTop 返回顶部、steps 步骤条、Transfer 穿梭框、Tree 树形、Upload 文件上传、Lazy 图片懒加载、Loading 加载、Pagination 分页等等
Stars: ✭ 156 (+940%)
Mutual labels:  table, vue-components
editable-react-table
React table built to resemble a database.
Stars: ✭ 519 (+3360%)
Mutual labels:  datatables, table
Vue Bootstrap4 Table
Advanced table based on Vue 2 and Bootstrap 4 ⚡️
Stars: ✭ 187 (+1146.67%)
Mutual labels:  table, vue-components
Vue Data Tables
A simple, customizable and pageable table with SSR support, based on vue2 and element-ui
Stars: ✭ 976 (+6406.67%)
Mutual labels:  datatables, table
vue-willtable
An editable table component for Vue.js 2.0
Stars: ✭ 119 (+693.33%)
Mutual labels:  table, vue-components
react-datatable
React-datatable is a component which provide ability to create multifunctional table using single component like jQuery Datatable. It's fully customizable and easy to integrate in any react component. Bootstrap compatible.
Stars: ✭ 72 (+380%)
Mutual labels:  datatables, table
Bootstrap Table
An extended table to integration with some of the most widely used CSS frameworks. (Supports Bootstrap, Semantic UI, Bulma, Material Design, Foundation, Vue.js)
Stars: ✭ 11,068 (+73686.67%)
Mutual labels:  datatables, table
Vuejs Datatable
A Vue.js component for filterable and paginated tables.
Stars: ✭ 148 (+886.67%)
Mutual labels:  table, vue-components
ant-table-extensions
Export, Search extensions to Ant Design's Table component.
Stars: ✭ 43 (+186.67%)
Mutual labels:  datatables, table
Vue Tables 2
Vue.js 2 grid components
Stars: ✭ 1,518 (+10020%)
Mutual labels:  table, vue-components
Heyui
🎉UI Toolkit for Web, Vue2.0 http://www.heyui.top
Stars: ✭ 2,373 (+15720%)
Mutual labels:  table, vue-components
hoc-element-table
📦 A Vue 3.x Table Component built on Webpack 5
Stars: ✭ 26 (+73.33%)
Mutual labels:  table, vue-components
Tablesaw
A group of plugins for responsive tables.
Stars: ✭ 5,497 (+36546.67%)
Mutual labels:  datatables, table
Vueye Table
A data table created using Vue.js
Stars: ✭ 64 (+326.67%)
Mutual labels:  datatables, vue-components
react-tisch
Table component for React and Bootstrap with real React components as cells
Stars: ✭ 17 (+13.33%)
Mutual labels:  datatables, table
vue-datatables
No description or website provided.
Stars: ✭ 22 (+46.67%)
Mutual labels:  datatables, vue-components
datatable-examples
Using DataTables plug-in for jQuery
Stars: ✭ 29 (+93.33%)
Mutual labels:  datatables

GitHub release license

vue data-table

Smart table using vue.js - sorting columns, filter by string, child rows, customs columns, custom row data

Alt text

Demo:

https://jsfiddle.net/mikemenaker/zuyvwvms/

Installation

With npm:

npm i v-data-table --save

With a CDN:

<!-- In <head> -->
<meta rel="stylesheet" href="https://unpkg.com/v-data-table/dist/v-data-table.css">
<!-- In <body>, after Vue import -->
<script src="https://unpkg.com/v-data-table/dist/v-data-table.js"></script>

Usage

With an ES6 bundler (via npm)

In your index file

import DataTable from 'v-data-table'
Vue.use(DataTable)

With a CDN

<script>
    Vue.use(DataTable)

    new Vue({
        // ...
    })
</script>

Props:

  • data
  • columnsToDisplay
    • Array
    • Which columns to display in table
  • columnsToNotDisplay
    • Array
    • Which columns to not display in table (cannot be used with columnsToDisplay)
  • aggregateColumns
    • Boolean
    • Walk all objects instead of just first object to get list of columns (cannot be used with columnsToDisplay)
  • displayNames
    • Object
    • Mapping of column name -> display name
  • filterKey
    • String
    • Filter data for string
  • childHideable
    • Boolean
    • Are child rows hideable (double click open/close)
  • childInitHide
    • Boolean
    • If child rows are expandable, should they be hidden initially
  • columnsToSort
    • Array
    • What columns should be sortable (columnsToNotSort will take precedence if both are provided)
  • columnsToNotSort
    • Array
    • What columns should not be sortable
  • childTransitionClass
    • String
    • CSS class to use in transition
  • itemsPerPage
    • Numbers
    • Enables pagination

Slots:

  • caption
    • Any caption that should be inserted before the header
  • child
    • Any sub row of child detail data
  • column
    • Any template for a column
  • nodata
    • Slot to display if the data provided is empty

Styling:

  • Selected columns have the class "active"
  • Arrows are a span with class "arrow"
  • Ascending/descending arrows also have class "asc"/"dsc"
th.active .arrow.asc {
    border-bottom: 4px solid #4d4d4d;
}

th.active .arrow.dsc {
    border-top: 4px solid #4d4d4d;
}

.arrow {
    display: inline-block;
    vertical-align: middle;
    width: 0;
    height: 0;
    margin-left: 5px;
}

.arrow.asc {
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 4px solid #cdc;
}

.arrow.dsc {
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid #cdc;
}

or with Font Awesome

.arrow.asc {
  position: relative;
}
.arrow.asc:before {
  content: "\f062";
  font-family: FontAwesome;
  position: absolute;
  left: -5px;
}

.arrow.dsc {
  position: relative;
}
.arrow.dsc:before {
  content: "\f063";
  font-family: FontAwesome;
  position: absolute;
  left: -5px;
}

-For pagination next page/previous page spans will have class "nextPage"/"previousPage"

.previousPage {
  position: relative;
}
.previousPage:before {
  content: "\f104";
  font-family: FontAwesome;
  position: absolute;
}

.nextPage {
  position: relative;
}
.nextPage:before {
  content: "\f105";
  font-family: FontAwesome;
  position: absolute;
  left: 5px;
}

Examples

Basic table:

<div id="demo">
  <data-table :data="gridData">
  </data-table>
</div>
var demo = new Vue({
  el: '#demo',
  data: {
    gridData: [{
      name: 'Chuck Norris',
      power: Infinity
    }, {
      name: 'Bruce Lee',
      power: 9000
    }, {
      name: 'Jackie Chan',
      power: 7000
    }, {
      name: 'Jet Li',
      power: 8000
    }]
  }
})

Only display certain columns:

<div id="demo">
  <data-table :data="gridData" :columns-to-display="gridColumns">
  </data-table>
</div>
var demo = new Vue({
  el: '#demo',
  data: {
    gridColumns: ['name', 'power'],
    gridData: [{
      name: 'Chuck Norris',
      power: Infinity
    }, {
      name: 'Bruce Lee',
      power: 9000
    }, {
      name: 'Jackie Chan',
      power: 7000
    }, {
      name: 'Jet Li',
      power: 8000
    }]
  }
})

Bind to search string:

<div id="demo">
  <form id="search">
    Search
    <input name="query" v-model="searchQuery">
  </form>
  <data-table :data="gridData" :filter-key="searchQuery">
  </data-table>
</div>
var demo = new Vue({
  el: '#demo',
  data: {
    searchQuery: '',
    gridData: [{
      name: 'Chuck Norris',
      power: Infinity
    }, {
      name: 'Bruce Lee',
      power: 9000
    }, {
      name: 'Jackie Chan',
      power: 7000
    }, {
      name: 'Jet Li',
      power: 8000
    }]
  }
})

Map display names of columns:

<div id="demo">
  <data-table :data="gridData" :display-names="displayNames">
  </data-table>
</div>
var demo = new Vue({
  el: '#demo',
  data: {
  displayNames: {
      'power': 'Super Powers'
    },
    gridData: [{
      name: 'Chuck Norris',
      power: Infinity
    }, {
      name: 'Bruce Lee',
      power: 9000
    }, {
      name: 'Jackie Chan',
      power: 7000
    }, {
      name: 'Jet Li',
      power: 8000
    }]
  }
})

Add a caption:

<div id="demo">
  <data-table :data="gridData">
    <template slot="caption">This is my caption</template>
  </data-table>
</div>
var demo = new Vue({
  el: '#demo',
  data: {
    gridData: [{
      name: 'Chuck Norris',
      power: Infinity
    }, {
      name: 'Bruce Lee',
      power: 9000
    }, {
      name: 'Jackie Chan',
      power: 7000
    }, {
      name: 'Jet Li',
      power: 8000
    }]
  }
})

Use template for a column (template name must match column name):

<div id="demo">
  <data-table :data="gridData">
    <template slot="name" scope="props">
      <b>{{props.entry.name}}</b>
      <br />
      <button @click="showPower(props.entry.power)">
        Show Power
      </button>
    </template>
  </data-table>
</div>
var demo = new Vue({
  el: '#demo',
  data: {
    gridData: [{
      name: 'Chuck Norris',
      power: Infinity
    }, {
      name: 'Bruce Lee',
      power: 9000
    }, {
      name: 'Jackie Chan',
      power: 7000
    }, {
      name: 'Jet Li',
      power: 8000
    }]
  },
  methods: {
    showPower(power) {
      alert(power);
    }
  }
})

Add a child row, each section will be a tbody of 2 rows (data row, child row):

<div id="demo">
  <data-table :data="gridData">
    <template slot="child" scope="props">
      This is my child row: {{props.entry.name}}
    </template>
  </data-table>
</div>
var demo = new Vue({
  el: '#demo',
  data: {
    gridData: [{
      name: 'Chuck Norris',
      power: Infinity
    }, {
      name: 'Bruce Lee',
      power: 9000
    }, {
      name: 'Jackie Chan',
      power: 7000
    }, {
      name: 'Jet Li',
      power: 8000
    }]
  }
})

Add ability to toggle child row (double click to open/close):

<div id="demo">
  <data-table :data="gridData" :child-hideable="true">
    <template slot="child" scope="props">
      This is my child row: {{props.entry.name}}
    </template>
  </data-table>
</div>
var demo = new Vue({
  el: '#demo',
  data: {
    gridData: [{
      name: 'Chuck Norris',
      power: Infinity
    }, {
      name: 'Bruce Lee',
      power: 9000
    }, {
      name: 'Jackie Chan',
      power: 7000
    }, {
      name: 'Jet Li',
      power: 8000
    }]
  }
})

Add ability to toggle child row (double click main row to open, double click child to close) and default to children rows closed:

<div id="demo">
  <data-table :data="gridData" :child-hideable="true" :child-init-hide="true">
    <template slot="child" scope="props">
      This is my child row: {{props.entry.name}}
    </template>
  </data-table>
</div>
var demo = new Vue({
  el: '#demo',
  data: {
    gridData: [{
      name: 'Chuck Norris',
      power: Infinity
    }, {
      name: 'Bruce Lee',
      power: 9000
    }, {
      name: 'Jackie Chan',
      power: 7000
    }, {
      name: 'Jet Li',
      power: 8000
    }]
  }
})
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].