149 lines
4.9 KiB
Vue
Executable File
149 lines
4.9 KiB
Vue
Executable File
<template>
|
|
<div>
|
|
<div class="content-section introduction">
|
|
<div class="feature-intro">
|
|
<h1>TreeTable <span>Column Resize</span></h1>
|
|
<p>Columns can be resized using drag drop by setting the resizableColumns to true. There are two resize modes; "fit" and "expand". Fit is the default one and the overall table width does not change when a column is resized.
|
|
In "expand" mode, table width also changes along with the column width.</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="content-section implementation">
|
|
<div class="card">
|
|
<h5>Fit Mode</h5>
|
|
<TreeTable :value="nodes" :resizableColumns="true" columnResizeMode="fit" class="p-treetable-gridlines">
|
|
<Column field="name" header="Name" :expander="true"></Column>
|
|
<Column field="size" header="Size"></Column>
|
|
<Column field="type" header="Type"></Column>
|
|
</TreeTable>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<h5>Expand Mode</h5>
|
|
<TreeTable :value="nodes" :resizableColumns="true" columnResizeMode="expand" class="p-treetable-gridlines">
|
|
<Column field="name" header="Name" :expander="true"></Column>
|
|
<Column field="size" header="Size"></Column>
|
|
<Column field="type" header="Type"></Column>
|
|
</TreeTable>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="content-section documentation">
|
|
<TabView>
|
|
<TabPanel header="Source">
|
|
<div class="p-d-flex p-jc-end">
|
|
<LiveEditor name="TreeTableDemo" :sources="sources" service="NodeService" data="treetablenodes" :components="['Column']" />
|
|
</div>
|
|
<pre v-code>
|
|
<code><template v-pre>
|
|
<h3>Fit Mode</h3>
|
|
<TreeTable :value="nodes" :resizableColumns="true" columnResizeMode="fit" class="p-treetable-gridlines">
|
|
<Column field="name" header="Name" :expander="true"></Column>
|
|
<Column field="size" header="Size"></Column>
|
|
<Column field="type" header="Type"></Column>
|
|
</TreeTable>
|
|
|
|
<h3>Expand Mode</h3>
|
|
<TreeTable :value="nodes" :resizableColumns="true" columnResizeMode="expand" class="p-treetable-gridlines">
|
|
<Column field="name" header="Name" :expander="true"></Column>
|
|
<Column field="size" header="Size"></Column>
|
|
<Column field="type" header="Type"></Column>
|
|
</TreeTable>
|
|
</template>
|
|
</code></pre>
|
|
|
|
<pre v-code.script>
|
|
<code>
|
|
import NodeService from '../../service/NodeService';
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
nodes: null
|
|
}
|
|
},
|
|
nodeService: null,
|
|
created() {
|
|
this.nodeService = new NodeService();
|
|
},
|
|
mounted() {
|
|
this.nodeService.getTreeTableNodes().then(data => this.nodes = data);
|
|
}
|
|
}
|
|
|
|
</code></pre>
|
|
|
|
</TabPanel>
|
|
</TabView>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import NodeService from '../../service/NodeService';
|
|
import LiveEditor from '../liveeditor/LiveEditor';
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
nodes: null,
|
|
sources: {
|
|
'template': {
|
|
content: `<template>
|
|
<div class="layout-content">
|
|
<div class="content-section implementation">
|
|
<div class="card">
|
|
<h5>Fit Mode</h5>
|
|
<TreeTable :value="nodes" :resizableColumns="true" columnResizeMode="fit" class="p-treetable-gridlines">
|
|
<Column field="name" header="Name" :expander="true"></Column>
|
|
<Column field="size" header="Size"></Column>
|
|
<Column field="type" header="Type"></Column>
|
|
</TreeTable>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<h5>Expand Mode</h5>
|
|
<TreeTable :value="nodes" :resizableColumns="true" columnResizeMode="expand" class="p-treetable-gridlines">
|
|
<Column field="name" header="Name" :expander="true"></Column>
|
|
<Column field="size" header="Size"></Column>
|
|
<Column field="type" header="Type"></Column>
|
|
</TreeTable>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import NodeService from '../service/NodeService';
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
nodes: null
|
|
}
|
|
},
|
|
nodeService: null,
|
|
created() {
|
|
this.nodeService = new NodeService();
|
|
},
|
|
mounted() {
|
|
this.nodeService.getTreeTableNodes().then(data => this.nodes = data);
|
|
}
|
|
}
|
|
`
|
|
}
|
|
}
|
|
}
|
|
},
|
|
nodeService: null,
|
|
created() {
|
|
this.nodeService = new NodeService();
|
|
},
|
|
mounted() {
|
|
this.nodeService.getTreeTableNodes().then(data => this.nodes = data);
|
|
},
|
|
components: {
|
|
LiveEditor
|
|
}
|
|
}
|
|
</script> |