Skip to content
This repository was archived by the owner on Jun 10, 2021. It is now read-only.

Commit d831d76

Browse files
committed
Added more docs and demo
1 parent c8f568f commit d831d76

8 files changed

+125
-29
lines changed

Diff for: README.md

+93-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,95 @@
1-
## Vue Datasource
2-
### A Vue.js component to create tables from Server Side
3-
#### Compatible with Vue 2.x
1+
# Vue Datasource
2+
#### A Vue.js component to create tables from Server SideCompatible with Vue 2.x
43

5-
!['Demo image'](https://github.com/coderdiaz/vue-datasource/blob/master/screens/frame-chrome-mac.png?raw=true)
4+
### Demo
65

7-
Coming soon..
6+
!['Example'](http://g.recordit.co/F9c92b277R.gif)
7+
8+
Coming soon live demo ...
9+
10+
### Install/Usage
11+
```
12+
$ npm install vue-datasource
13+
```
14+
15+
```html
16+
<div id="#app">
17+
<datasource
18+
language="en"
19+
:table-data="information.data"
20+
:columns="columns"
21+
:pagination="users.pagination"
22+
:actions="actions"
23+
v-on:change="changePage"
24+
v-on:searching="onSearch"></datasource>
25+
</div>
26+
```
27+
28+
```javascript
29+
import Datasource from 'vue-datasource'
30+
31+
new Vue({
32+
el: '#app',
33+
components: {
34+
Datasource
35+
},
36+
data() {
37+
return {
38+
information: {
39+
pagination: {...},
40+
data: [...]
41+
},
42+
columns: [...],
43+
actions: [...]
44+
}
45+
},
46+
methods: {
47+
changePage(values) {...},
48+
onSearch(searchQuery) {...}
49+
}
50+
});
51+
```
52+
53+
### Available Props
54+
| Prop | Type | Default | Description |
55+
|-------------|---------|---------|-------------------------------------------------------------|
56+
| tableData | Array | | The table information to display |
57+
| language | String | es | Defines the language with which the table will be displayed |
58+
| columns | Array | | Columns to display in table |
59+
| pagination | Object | | Information about data collection to paginate |
60+
| actions | Array | | Buttons to perform action on click event |
61+
62+
### Available Events
63+
| Event | Description |
64+
|-------------|------------------------------------------------|
65+
| change | Return the limit per page and the current page |
66+
| searching | Return the string to search |
67+
68+
### Render column value with custom format
69+
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.
70+
```javascript
71+
{
72+
...,
73+
columns: [
74+
{
75+
name: 'Name', // Header name column
76+
// Name of column on table. If you are working in Laravel
77+
// you can access the relationships using 'relation.key'
78+
key: 'name',
79+
render(value) {
80+
return `Enginner ${value}`;
81+
}
82+
}
83+
]
84+
}
85+
```
86+
87+
### Implementation examples
88+
- Using Laravel 5.3 and pagination: [laravel-datasource-example](https://github.com/coderdiaz/laravel-datasource-example).
89+
90+
_You can add implementations send me your PR._
91+
92+
### Contributions
93+
All contributions are welcome send your PR and Issues.
94+
95+
Created by Javier Diaz

Diff for: dist/example.js

+14-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/example.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/vue-datasource.js

+14-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/vue-datasource.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)