1.1.6 • Published 4 years ago

@parthfaladu/vue-js-datatable v1.1.6

Weekly downloads
50
License
MIT
Repository
github
Last release
4 years ago

vue-js-datatable

npm version

vue-js-datatable is wrapper vue package of datatables.net

Installation

npm install --save @parthfaladu/vue-js-datatable

Or using yarn

yarn add @parthfaladu/vue-js-datatable -dev

For Installing plugin import vue-js-datatable in your component page.

//foo.vue
import VueJsDatatable from "@parthfaladu/vue-js-datatable";
export default {
  components: {
    VueJsDatatable,
  },
}

Note

Please note that this package depends on jQuery and jquery.dataTables.js, but you won't need to add it to your project manually, vue-js-datatable will handle this for you automatically if this dependencies are not detected.

CSS

For styling of the table import datatable css file.

Basic Usage

You can pass an array of fullclendar objects through the props

<VueJsDatatable :url="url" type="post" :columns="columns" @gaction="onAction">
    <th>ID</th>
    <th>name</th>
    <th>City</th>
    <th>Action</th>
</VueJsDatatable>
...
<script>
import VueJsDatatable from '@parthfaladu/vue-js-datatable';
...
  components: {
	VueJsDatatable,
  },
  data() {
    return {
        columns: [
          {data:'id', name:'id' , width:"100px"},
          {data:'name', name:'name' , width:"300px"},
          {data:'city', name:'city' , width:"200px"},
          {data:(data) => {
		return "<button class='btn btn-outline-alternate' data-g-action='view' data-g-actiondata="+data.id+">Edit</button>";
	  }, name:'action', width:"150px"}
	],
	url: 'https://example.com/api/v1/get/user'
    }
  },
  ...
  methods: {
    onAction(action) {
	if(action.action === 'view') {
		console.log('view button click.');
	}
    }
  }
...
</script>

Props

NameTypeDefaultDescription
columnsArray[]Table all columns
urlStringnullAjax request url
typeString'GET'Ajax request type
searchingBooleantrueFeature control search (filtering) abilities
lengthChangeBooleantrueFeature control the end user's ability to change the paging display length of the table
pagingBooleantrueEnable or disable table pagination
orderingBooleantrueFeature control ordering (sorting) abilities in DataTables
classNameString''Table class names
serverSideBooleantrueFeature control DataTables' server-side processing mode
headersObject{}Ajax request headers
orderArray[]Initial order (sort) to apply to the table

Events

NameDescription
gactionIn button define data-g-action='view' attribute and on button click this event will be emitted
1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago