90 lines
2.9 KiB
Vue
90 lines
2.9 KiB
Vue
<template>
|
|
<DocSectionText v-bind="$attrs">
|
|
<p>
|
|
Columns can be resized with drag and drop when <i>resizableColumns</i> is enabled. Default resize mode is <i>fit</i>
|
|
that does not change the overall table width.
|
|
</p>
|
|
</DocSectionText>
|
|
<div class="card">
|
|
<DataTable :value="products" resizableColumns columnResizeMode="fit" showGridlines tableStyle="min-width: 50rem">
|
|
<Column field="code" header="Code"></Column>
|
|
<Column field="name" header="Name"></Column>
|
|
<Column field="category" header="Category"></Column>
|
|
<Column field="quantity" header="Quantity"></Column>
|
|
</DataTable>
|
|
</div>
|
|
<DocSectionCode :code="code" :service="['ProductService']" />
|
|
</template>
|
|
|
|
<script>
|
|
import { ProductService } from '@/service/ProductService';
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
products: null,
|
|
code: {
|
|
basic: `
|
|
<DataTable :value="products" resizableColumns columnResizeMode="fit" showGridlines tableStyle="min-width: 50rem">
|
|
<Column field="code" header="Code"></Column>
|
|
<Column field="name" header="Name"></Column>
|
|
<Column field="category" header="Category"></Column>
|
|
<Column field="quantity" header="Quantity"></Column>
|
|
</DataTable>`,
|
|
options: `
|
|
<template>
|
|
<div class="card">
|
|
<DataTable :value="products" resizableColumns columnResizeMode="fit" showGridlines tableStyle="min-width: 50rem">
|
|
<Column field="code" header="Code"></Column>
|
|
<Column field="name" header="Name"></Column>
|
|
<Column field="category" header="Category"></Column>
|
|
<Column field="quantity" header="Quantity"></Column>
|
|
</DataTable>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { ProductService } from '@/service/ProductService';
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
products: null
|
|
};
|
|
},
|
|
mounted() {
|
|
ProductService.getProductsSmall().then((data) => (this.products = data));
|
|
}
|
|
};
|
|
<\/script>`,
|
|
composition: `
|
|
<template>
|
|
<div class="card">
|
|
<DataTable :value="products" resizableColumns columnResizeMode="fit" showGridlines tableStyle="min-width: 50rem">
|
|
<Column field="code" header="Code"></Column>
|
|
<Column field="name" header="Name"></Column>
|
|
<Column field="category" header="Category"></Column>
|
|
<Column field="quantity" header="Quantity"></Column>
|
|
</DataTable>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { ref, onMounted } from 'vue';
|
|
import { ProductService } from '@/service/ProductService';
|
|
|
|
onMounted(() => {
|
|
productService.value.getProductsSmall().then(data => products.value = data);
|
|
});
|
|
|
|
const products = ref();
|
|
<\/script>`
|
|
}
|
|
};
|
|
},
|
|
mounted() {
|
|
ProductService.getProductsSmall().then((data) => (this.products = data));
|
|
}
|
|
};
|
|
</script>
|