Temporal: http://recordit.co/F9c92b277R
Coming soon live demo ...
$ npm install vue-datasource
<div id="#app">
<datasource
language="en"
:table-data="information.data"
:columns="columns"
:pagination="users.pagination"
:actions="actions"
v-on:change="changePage"
v-on:searching="onSearch"></datasource>
</div>
import Datasource from 'vue-datasource'
new Vue({
el: '#app',
components: {
Datasource
},
data() {
return {
information: {
pagination: {...},
data: [...]
},
columns: [...],
actions: [...]
}
},
methods: {
changePage(values) {...},
onSearch(searchQuery) {...}
}
});
Prop | Type | Default | Description |
---|---|---|---|
tableData | Array | The table information to display | |
language | String | es | Defines the language with which the table will be displayed |
columns | Array | Columns to display in table | |
pagination | Object | Information about data collection to paginate | |
actions | Array | Buttons to perform action on click event |
Event | Description |
---|---|
change | Return the limit per page and the current page |
searching | Return the string to search |
To show the value of a column with a custom format uses the render property, this will allow you to get the original value and return it in the way you define.
{
...,
columns: [
{
name: 'Name', // Header name column
// Name of column on table. If you are working in Laravel
// you can access the relationships using 'relation.key'
key: 'name',
render(value) {
return `Enginner ${value}`;
}
}
]
}
- Using Laravel 5.3 and pagination: laravel-datasource-example.
You can add implementations send me your PR.
All contributions are welcome send your PR and Issues.