1.0.7 • Published 6 years ago

vue-crud-tables v1.0.7

Weekly downloads
6
License
MIT
Repository
github
Last release
6 years ago

vue-crud-tables

Smart Vue table component with crud functionality

Example

Demo: https://vue-crud-tables.herokuapp.com

Uses

    npm install vue-crud-tables
    import VueTables from 'vue-crud-tables'
    
    Vue.use(VueTables);
     <vue-table :columns="my-columns" :data="my-data" :options="table-options"></vue-table>

Documentation

vue-crud-tables props

:columns (type: Array)

OptionTypeValues(default)Description
nameString(empty string)Name of column. It must be the same as the corresponding attribute name i data props
labelString(empty string)Column label in table header
typeStringtext(default), selectType of table cell
requireBooleantrue(default), falseIf cell is required before save
filtrableBooleantrue, false(default)If column is filtrable
sortableBooleantrue, false(default)If column is sortable
editableBooleantrue, false(default)If column is editable
dataArray{id: Number,label: String} (empty array)Array of options to select in editable mode

Example

    var columns = [
        {
          name: 'firstName',
          label: 'First name',
          type: 'text',
          require: true,
          filtrable: true,
          sortable: true,
          editable: true
        },
        {
          name: 'lastName',
          label: 'Last name',
          type: 'text',
          require: true,
          filtrable: true,
          sortable: true,
          editable: true
        },
        {
          name: 'city',
          label: 'City',
          type: 'select',
          data: [
            {
              id: 1,
              label: 'Warsaw'
            },{
              id: 2,
              label: 'New York'
            },{
              id: 3,
              label: 'Moscow'
            }
          ],
          require: true,
          filtrable: true,
          sortable: true,
          editable: true
        }
    ]

:data (type: Array)

Array of data objects. Object attributes must be the same as names attributes in columns.

:options (type: Object)

OptionTypeValues(default)Description
tableNameString"table"(default)Name of table
styleString"bootstrap"(default)Choose default style of table
classesString"table"(default)class attribute in table tag
urlStringnull(default)Url it is address of endpoint for table data. It can also be an address to the CRUD operations API implemented same like below example: Fetch table data GET /post Add new row POST /posts Edit Row PUT /posts/1Delete row DELETE /posts/1
editModeString"row"(default), "modal"Choose method of editing row, "modal" option is aviable only for "bootstrap" style
editButtonTmpString<a href="#">edit</a> (default)Edit button template
deleteButtonTmpString<a href="#">delete</a> (default)Delete button template
cancelButtonTmpString<a href="#">cancel</a> (default)Cancel button template
saveButtonTmpString<a href="#">save</a> (default)Save button template
customActionTmpString(empty string)Custom buttons template
buttonsFloatString"left"(default), "right"Location of action buttons in table
deleteFnFunction(default function)Default delete method
saveFnFunction(default function)Default save method
deleteCallbackFnFunction(default callback function)Default delete callback method
saveCallBackFnFunction(default callback function)Default save callback method

Example

 var options = {       
        classes: 'table',
        tableName: 'my-table',
        editMode: 'row',  
        url: 'https://jsonplaceholder.typicode.com/posts',             
        customActionTmp: '', 
        buttonsFloat: 'left'
  }

Extra functions

FunctionParameters(Type)DescriptionExample
addRowtableName(String)Adding new row to tablethis.$VueTable.addRow('my-table');
1.0.7

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.0

6 years ago