treegrid 0.0.7
Install from the command line:
Learn more about npm packages
$ npm install @ks-labs/treegrid@0.0.7
Install via package.json:
"@ks-labs/treegrid": "0.0.7"
About this version
- Install npm module
npm i @ks-labs/treegrid
- Import module
// main.js
import Vue from "vue";
import TreeGrid from "@ks-labs/treegrid";
import "@ks-labs/treegrid/src/assets/css/jquery.treegrid.css";
Vue.use(TreeGrid);
<template>
<div>
<treegrid
class="table table-bordered"
:rows="rows"
:columns="columns"
:options="options"
@row="clickRow"
>
<template slot="name" slot-scope="{ name }">{{ name }}</template>
// name = { name: "Root", id: 1, pid: null, }
</treegrid>
</div>
</template>
<script>
export default {
name: "app",
data() {
return {
columns: [{ name: "Nome", field: "name" }],
rows: [
{
name: "Root",
id: 1,
pid: null,
},
{
name: "Root 1",
id: 2,
pid: 1,
},
{
name: "Root 1",
id: 3,
pid: 1,
},
{
name: "Root 1",
id: 4,
pid: 1,
},
{
name: "Root 1",
id: 5,
pid: 4,
},
{
name: "Root 1",
id: 6,
pid: null,
},
{
name: "Root 7",
id: 7,
pid: 6,
},
{
name: "Root 7 - 1",
id: 8,
pid: 7,
},
{
name: "Root 1",
id: 9,
pid: 6,
},
{
name: "Root 1",
id: 10,
pid: 6,
},
],
options: {},
};
},
};
</script>