Giter VIP home page Giter VIP logo

red-data-table's Introduction

Red DataTable

This project is a custom DataTable project component for Vuejs 3 written in TypeScript.

Installation

Copy the folder RedDataTable from /src/components tou your project and include in yout vue file:

// Component
import RedDataTable from '@/components/RedDataTable'

// Additional types
import { RedDataTableHeader } from 'types/red-data-table'

If you are using Options API you need to load RedDataTable in components property:

export default defineComponent({
  components: {
    RedDataTable
  }
})

Dependencies

To run the project you need to install dependencies. I used npm and the package-lock.json file is also provided. In console type npm install to get all packages.

Features

  • Minimal styles provided (w/ scss)
  • Pagination
  • Headers and column chooser
  • Columns resize
  • Row selection
  • Search

Options

  • Borders and alternate rows style
  • Column sorting
  • Header and item customization (via slots)
  • Items per page customization
  • Single and multiple selction

Example

You can view full implementation in /src/views/HomeView.vue file. Because is a vue project you can also run it with npm run serve command.

The example below is witten using Composition API and is a basic implementation:

<template>
  <RedDataTable
    :headers="headers"
    :items="items"
  />
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { RedDataTableHeader } from 'types/red-data-table'
import RedDataTable from '@/components/RedDataTable'

const headers = ref<RedDataTableHeader[]>([])
const items = ref<any>([])

headers.value = [
  {
    text: 'Dessert (100g serving)',
    align: 'left',
    sortable: true,
    value: 'name'
  },
  {
    text: 'Calories',
    value: 'calories',
    sortable: true,
    align: 'right'
  }
]
items.value = [
  {
    name: 'Frozen Yogurt',
    calories: 159
  },
  {
    name: 'Ice cream sandwich',
    calories: 237
  },
  {
    name: 'Eclair',
    calories: 262
  }
]
</script>

Enjoy ;)

red-data-table's People

Contributors

mrred85 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.