You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+17-257
Original file line number
Diff line number
Diff line change
@@ -4,17 +4,21 @@
4
4
5
5
A Vue wrapper component for [Grid.js](https://gridjs.io).
6
6
7
-
[](https://www.npmjs.com/package/gridjs-vue)[](https://github.com/grid-js/gridjs-vue/issues)[](https://discord.com/invite/K55BwDY)
Also available on [unpkg](https://unpkg.com/browse/[email protected]/dist/) and [Skypack](https://www.skypack.dev/view/gridjs-vue)!
18
22
19
23
```html
20
24
<script>
@@ -28,26 +32,17 @@ npm install gridjs-vue
28
32
</script>
29
33
```
30
34
31
-
#### Global Registration
32
-
33
-
```js
34
-
/* in `main.js` or wherever you specify your global components */
35
-
import { GridGlobal } from'gridjs-vue'
36
-
37
-
Vue.use(GridGlobal)
38
-
```
39
-
40
-
## Usage
35
+
## Basic Usage
41
36
42
-
Pass `cols` (an array of column headers) and either `rows`, `from`, or `server` as a data source to the component. Everything else is optional. Pass in new data to update the table.
37
+
Pass `columns` (an array of column headers) and either `rows`, `from`, or `server` as a data source to the component. Everything else is optional. Pass in new data to update the table.
43
38
44
-
Refer to [Grid.js documentation](https://gridjs.io/docs/config/) for specific configuration options. This module may lag behind the main Grid.js module somewhat, so check the API version badge at the top of this README.
39
+
**[Read the full documentation](docs/index.md) for further configuration options.**
If you install the component globally, rather than importing it locally, the following helpers are added to the Vue prototype and are available globally.
225
-
226
-
#### \$gridjs.uuid
227
-
228
-
Returns a unique identifier that can be used to reference the current cell.
229
-
230
-
Usage:
231
-
232
-
```js
233
-
constref=this.$gridjs.uuid()
234
-
```
235
-
236
-
#### \$gridjs.h
237
-
238
-
Renders a [Preact virtual DOM instance](https://gridjs.io/docs/examples/virtual-dom). Grid.js is built in Preact, so why not take advantage of it?
239
-
240
-
Usage:
241
-
242
-
```js
243
-
this.cols= [
244
-
{
245
-
name:'Actions',
246
-
formatter: (cell, row) => {
247
-
returnthis.$gridjs.h('button', {
248
-
onClick: () =>alert(`
249
-
Editing "${row.cells[0].data}"
250
-
`)
251
-
}, 'Edit')
252
-
}
253
-
},
254
-
{ ... },
255
-
{ ... }
256
-
]
257
-
```
258
-
259
-
#### \$gridjs.html
260
-
261
-
Renders [HTML in a formatter function](https://gridjs.io/docs/examples/html-cells).
0 commit comments