1.0.7 • Published 2 years ago

vue-datatable-ele v1.0.7

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

Table of Contents

Introduction

VueDatatableEle is an Vue table component.\ VueDatatableEle is a MIT-licensed open source project, it is a table component for your Vue 3 Project which does not have any thrid party library dependencies.\ Tested in Firefox, Safari, Chrome, Opera, Internet Explorer 8+. VueDatatableEle is lightweight and highly configurable which makes its useful in number of situations.

Features

  • Lightweight.
  • Highly configurable.
  • In built pagination.
  • Easily to hooked in on Bootstrap.
  • No jQuery or other dependencies.

Installation

npm install vue-datatable-ele

Usage

import VueDatatableEle from 'vue-datatable-ele'

Configuration

PropTypeDescription
v-modelArrayArray of table rows.
columnsArrayArray of table column names.
actionsObjectArray of table actions if any, check the example below for the defination.
paginateObjectData required for pagination, check the example below for the defination.
tableClassStringCustom table class
withoutPaginationBooleanRemoves pagination from table

Events

EventDescription
pageChangedEvent occer when click on pagination links

Example

<template>
    <vue-datatable-ele
        v-model="records"
        :columns="columns"
        :actions="actions"
        :paginate="paginate"
        :tableClass="'table table-bordered table-responsive'"
        @pageChanged="api.page = $event"
    >
        <template v-slot:table-header>
            <div class="row">
                <div class="col">
                    <h3>Users Table</h3>
                </div>
            </div>
        </template>

        <template v-slot:table-body="{showColumn, showAction}">
            <tr v-for="(record, index) in records">
                <td v-if="showAction('edit')">
                    <a href="">Edit</a>
                </td>
                <td v-if="showAction('delete')">
                    <a href="">Delete</a>
                </td>
                <td
                    v-if="showColumn('Id')"
                    class="text-center"
                >
                    {{ record.id }}
                </td>
                <td v-if="showColumn('First Name')"> {{ record.first_name }} </td>
                <td v-if="showColumn('Last Name')"> {{ record.last_name }} </td>
                <td v-if="showColumn('Email')"> {{ record.email }} </td>
            </tr>
        </template>
    </vue-datatable-ele>
</template>


<script>
    import VueDatatableEle from 'vue-datatable-ele'

    export default {
        components: {VueDatatableEle},

        data() {
            return {
                columns: [
                    'Id',
                    'First Name',
                    'Last Name',
                    'Email',
                ],
                actions: {
                    'edit': true,
                    'delete': true,
                },
                paginate: {
                    page: 1,
                    limit: 6,
                    total: 0,
                },
                records: [],
            }
        },

        watch: {
            'paginate.page': 'fetch'
        },

        methods: {
            fetch() {
                // fetch and set records.
            }
        },

        created() {
            this.fetch();
        }
    }

</script>
1.0.7

2 years ago

3.0.4

2 years ago

3.0.3

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

2.0.0

2 years ago

1.0.0

2 years ago