• Stars
    star
    112
  • Rank 302,117 (Top 7 %)
  • Language Vue
  • License
    MIT License
  • Created over 5 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A data table created using Vue.js

Vueye Table

Vueye data table is a responsive data table component based on Vue.js, it organizes your data per pages in order to navigate easily.

Vueye

This component allows you to :

  • Paginate data (server/client side)
  • Filter by field
  • Sort columns
  • Show only desired columns
  • Custom cells rendering

Docs

Documentation

Boilerplate in codesandbox (update the component dependency to the latest version)

Requirement

  • Vue.js ^2.6 + composition-api
  • It doesn't require any CSS framework

Installation

npm install vueye-table --save

Usage

<template>
  <div id="app">
    <VueyeTable :data="employees" :columns="columns" title="Employees" filter-by="employee_salary">
      <template v-slot:employee_salary="{item}">
        <b
          v-if="item.employee_salary>100000"
          style="background:#3bb640;color:white"
        >{{item.employee_salary}}</b>
        <b v-else style="background:#ee4422;color:white">{{item.employee_salary}}</b>
      </template>
      <template v-slot:actions="{item}">
        <div class="ve-table-actions">
          <button class="ve-table-btn ve-table-btn-primary" @click="edit(item)">Edit</button>
          <button class="ve-table-btn ve-table-btn-danger" @click="deleteItem(item)">Delete</button>
        </div>
      </template>
    </VueyeTable>
  </div>
</template>

<script>
import VueyeTable from "./components/VueyeTable.vue";
import employees from "./assets/employees.json";
export default {
  name: "App",
  data: () => ({
    employees: employees,
    columns: [
      {
        key: "id",
        label: "ID",
        sortable: true,
        type: "number",
        display: true
      },
      {
        key: "employee_name",
        label: "Employee Name",
        sortable: true,
        display: true
      },
      {
        key: "employee_salary",
        label: "Employee Salary",
        display: true,
        sortable: true
      },
      {
        key: "employee_age",
        label: "Employee Age",
        sortable: true
      },
      {
        key: "address.city",
        label: "Address",
        display: true,
        sortable: true
      },
      {
        key: "actions",
        label: "Actions",
        sortable: false,
        display: true
      }
    ],
    selectedRows: []
  }),
  methods: {
    edit(item) {
      //open a dialog to edit the selected item
      //or redirect to another page that contains
      // edit form
    },
    deleteItem(item) {
      this.employees = this.employees.filter(
        employee => employee.id !== item.id
      );
    }
  },
  components: {
    VueyeTable
  }
};
</script>

<style lang="scss">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.ve-table {
  &-actions {
    width: 104px;
    display: flex;
    justify-content: space-around;
    align-items: center;
  }
  &-btn {
    height: 24px;
    min-width: 32px;
    padding: 0 8px;
    text-align: center;
    border-radius: 4px;

    cursor: pointer;
    justify-content: center;
    outline: none;
    border: none;
    position: relative;
    white-space: nowrap;
    &-primary {
      background: #3844cc;
      color: white;
    }
    &-danger {
      background: #e24e40;
      color: white;
    }
  }
}
</style>

In main.js add @vue/composition-api plugin to make work with Vue.js 2 :

import Vue from 'vue';
import App from './App.vue';
import VueComp from '@vue/composition-api';
Vue.config.productionTip = false;

Vue.use(VueComp);

new Vue({
	render: h => h(App),
}).$mount('#app');

Props

Name Description
title the data table title
columns the attributes or columns
data JS array of object or json content
filter-by specify the default column for filter
per-page-values the array of per pages values
per-page the default per page
select-rows add checkbox columns in order to select rows
v-model returns the selected rows
dense Show table rows in small size
striped Apply striped style
bordered make the table bordered
header-display show/hide the table header

More Repositories

1

vueye

Vue 3 template with many components based on Tailwind CSS 3 and Typescript
Vue
106
star
2

vue3-tailwind2

Vue 3 with tailwindcss 2 template
TypeScript
80
star
3

vue-pro-sidebar

responsive sidebar using vue.js with ability to change theme
Vue
80
star
4

laravel-vue-3-starter

a pre-configured project using Laravel 8 and Vue 3
PHP
61
star
5

vue-spring-calendar

Full Calendar based on Vue.js
JavaScript
42
star
6

vuetalize

Vuetalize - Vuetify 3 template
Vue
35
star
7

vue3-router-tree

Tree that represents the routes structure
Vue
34
star
8

vue3-webpack

Vue 3 + webpack 4 starter
JavaScript
26
star
9

vitesse-react

React starter template
TypeScript
20
star
10

spring-calendar

Full calendar based on React.js used to show events by day, week, month and year
JavaScript
18
star
11

react-md-select

It's React βš›οΈ based component that allows you to select item(s) from a set of items which could be custom rendered or loaded asynchronously
JavaScript
15
star
12

boussadjra

About me
14
star
13

vue-cheat-sheet

It's a Vue stuff based on https://github.com/dekadentno/vue-cheat-sheet
14
star
14

vueye-timeline

A component based on Vue.js
Vue
13
star
15

vueye-datepicker

Date picker input created using Vue and Vue composition api
JavaScript
13
star
16

vueye-phone-input

phone number input built for Vue.js 3
TypeScript
12
star
17

nocturne-birds-theme

A Visual Studio Code theme with elegant colors based on good contrast.
12
star
18

reaction-timeline

It's a React βš›οΈ based component that shows item set in chronological way.
HTML
9
star
19

twelve

Laravel 8 project built using Vue.js 3 (Vitejs) + TailwindCSS 2 + Typescript
TypeScript
8
star
20

loginform

Simple Login form
CSS
8
star
21

coding-challenge

Coding challenge to create an app for drawing graphs
PHP
7
star
22

awesome-vue

πŸŽ‰ A curated list of awesome things related to Vue.js
6
star
23

windy-nuxt

Nuxt.js starter template based on Tailwindcss
Vue
6
star
24

blue-landing-page

Creation of landing page using some of css tricks like clip-path, flex and grid layouts
CSS
6
star
25

alwasaet_coding_test

A coding test from Alwasaet to build an email template
Vue
2
star
26

almawrid

wordle game in arabic
TypeScript
1
star
27

vue-script-setup-snippets

This extension adds snippets for script setup syntax.
1
star