Code Monkey home page Code Monkey logo

vue-data-table's Introduction

Vue Data Table

Documentation

DataTable

<DataTable :defs="defs" :rows="items" :onRowSelect="handleRowSelect" />

Props:

defs

The prop defs is an array of column definitions. Each column definition must have the following shape:

export interface ColumnDef {
  // the column name
  name: string;
  // whether the column should be displayed
  display?: boolean;
  // left or right (default: left)
  align?: string;
  // the column width
  width?: string;
  // a function that describes how the columns should be sorted
  compare?: (a: any, b: any) => number;
  // how the column field should be displayed
  transform?: (data: any) => string;
}
rows

The prop rows is an array of objects withs keys for each column name.

export interface Row {
  [key: string]: any;
}

const rows: Row[] = {
  /*...*/
};
onRowSelect

The prop onRowSelect is an callback that is triggered whenever a row is clicked. It receives as paramenter the row it self.

type OnRowSelect = (row: Row) => void;

WithSearch

<WithSearch :defs="defs" :rows="items" :onRowSelect="handleRowSelect" defaultFilter="name">
  <DataTable slot-scope="tableProps" v-bind="tableProps"/>
</WithSearch>

WithSearch is a wrapper for DataTable. It receives the same props and pass then along through slot-scope. In addition to that it receives a defaultFilter prop which correspond to a column name.

vue-data-table's People

Contributors

malbernaz avatar

Stargazers

Roman avatar

Watchers

James Cloos 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.