primevue-mirror/apps/showcase/doc/treetable/pagination/PaginationTemplateDoc.vue

217 lines
6.8 KiB
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>
Paginator UI is customized using the <i>paginatorTemplate</i> property. Each element can also be customized further with your own UI to replace the default one, refer to the
<PrimeVueNuxtLink to="/paginator">Paginator</PrimeVueNuxtLink> component for more information about the advanced customization options.
2023-02-28 08:29:30 +00:00
</p>
</DocSectionText>
2024-02-21 07:31:43 +00:00
<DeferredDemo @load="loadDemoData">
<div class="card">
<TreeTable
:value="nodes"
:paginator="true"
:rows="5"
:rowsPerPageOptions="[5, 10, 25, 50]"
paginatorTemplate="RowsPerPageDropdown FirstPageLink PrevPageLink CurrentPageReport NextPageLink LastPageLink"
currentPageReportTemplate="{first} to {last} of {totalRecords}"
2024-05-03 06:34:31 +00:00
tableStyle="min-width: 50rem"
2024-02-21 07:31:43 +00:00
>
<template #paginatorstart>
<Button type="button" icon="pi pi-refresh" text />
</template>
2024-05-03 06:34:31 +00:00
<Column field="name" header="Name" expander style="width: 34%"></Column>
<Column field="size" header="Size" style="width: 33%"></Column>
<Column field="type" header="Type" style="width: 33%"></Column>
2024-02-21 07:31:43 +00:00
<template #paginatorend>
<Button type="button" icon="pi pi-download" text />
</template>
</TreeTable>
</div>
</DeferredDemo>
2023-02-28 08:29:30 +00:00
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
nodes: null,
code: {
2023-09-22 12:54:14 +00:00
basic: `
2024-05-03 06:34:31 +00:00
<TreeTable
:value="nodes"
:paginator="true"
:rows="5"
:rowsPerPageOptions="[5, 10, 25, 50]"
2023-02-28 08:29:30 +00:00
paginatorTemplate="RowsPerPageDropdown FirstPageLink PrevPageLink CurrentPageReport NextPageLink LastPageLink"
2024-05-03 06:34:31 +00:00
currentPageReportTemplate="{first} to {last} of {totalRecords}"
tableStyle="min-width: 50rem"
>
2023-02-28 08:29:30 +00:00
<template #paginatorstart>
2023-03-03 12:15:20 +00:00
<Button type="button" icon="pi pi-refresh" text />
2023-02-28 08:29:30 +00:00
</template>
2024-05-03 06:34:31 +00:00
<Column field="name" header="Name" expander style="width: 34%"></Column>
<Column field="size" header="Size" style="width: 33%"></Column>
<Column field="type" header="Type" style="width: 33%"></Column>
2023-02-28 08:29:30 +00:00
<template #paginatorend>
2023-03-03 12:15:20 +00:00
<Button type="button" icon="pi pi-download" text />
2023-02-28 08:29:30 +00:00
</template>
2023-10-15 09:38:39 +00:00
</TreeTable>
`,
2023-09-22 12:54:14 +00:00
options: `
<template>
2023-02-28 08:29:30 +00:00
<div class="card">
2024-05-03 06:34:31 +00:00
<TreeTable
:value="nodes"
:paginator="true"
:rows="5"
:rowsPerPageOptions="[5, 10, 25, 50]"
2023-02-28 08:29:30 +00:00
paginatorTemplate="RowsPerPageDropdown FirstPageLink PrevPageLink CurrentPageReport NextPageLink LastPageLink"
2024-05-03 06:34:31 +00:00
currentPageReportTemplate="{first} to {last} of {totalRecords}"
tableStyle="min-width: 50rem"
>
2023-02-28 08:29:30 +00:00
<template #paginatorstart>
2023-03-03 12:15:20 +00:00
<Button type="button" icon="pi pi-refresh" text />
2023-02-28 08:29:30 +00:00
</template>
2024-05-03 06:34:31 +00:00
<Column field="name" header="Name" expander style="width: 34%"></Column>
<Column field="size" header="Size" style="width: 33%"></Column>
<Column field="type" header="Type" style="width: 33%"></Column>
2023-02-28 08:29:30 +00:00
<template #paginatorend>
2023-03-03 12:15:20 +00:00
<Button type="button" icon="pi pi-download" text />
2023-02-28 08:29:30 +00:00
</template>
</TreeTable>
</div>
</template>
<script>
export default {
data() {
return {
nodes: null,
}
},
created() {
let files = [];
for (let i = 0; i < 50; i++) {
let node = {
key: i,
data: {
name: 'Item ' + i,
size: Math.floor(Math.random() * 1000) + 1 + 'kb',
type: 'Type ' + i
},
children: [
{
key: i + ' - 0',
data: {
name: 'Item ' + i + ' - 0',
size: Math.floor(Math.random() * 1000) + 1 + 'kb',
type: 'Type ' + i
}
}
]
};
files.push(node);
}
this.nodes = files;
}
}
2023-10-15 09:38:39 +00:00
<\/script>
`,
2023-09-22 12:54:14 +00:00
composition: `
<template>
2023-02-28 08:29:30 +00:00
<div class="card">
2024-05-03 06:34:31 +00:00
<TreeTable
:value="nodes"
:paginator="true"
:rows="5"
:rowsPerPageOptions="[5, 10, 25, 50]"
2023-02-28 08:29:30 +00:00
paginatorTemplate="RowsPerPageDropdown FirstPageLink PrevPageLink CurrentPageReport NextPageLink LastPageLink"
2024-05-03 06:34:31 +00:00
currentPageReportTemplate="{first} to {last} of {totalRecords}"
tableStyle="min-width: 50rem"
>
2023-02-28 08:29:30 +00:00
<template #paginatorstart>
2023-03-03 12:15:20 +00:00
<Button type="button" icon="pi pi-refresh" text />
2023-02-28 08:29:30 +00:00
</template>
2024-05-03 06:34:31 +00:00
<Column field="name" header="Name" expander style="width: 34%"></Column>
<Column field="size" header="Size" style="width: 33%"></Column>
<Column field="type" header="Type" style="width: 33%"></Column>
2023-02-28 08:29:30 +00:00
<template #paginatorend>
2023-03-03 12:15:20 +00:00
<Button type="button" icon="pi pi-download" text />
2023-02-28 08:29:30 +00:00
</template>
</TreeTable>
</div>
</template>
<script setup>
import { ref } from 'vue';
const nodes = ref();
let files = [];
for (let i = 0; i < 50; i++) {
let node = {
key: i,
data: {
name: 'Item ' + i,
size: Math.floor(Math.random() * 1000) + 1 + 'kb',
type: 'Type ' + i
},
children: [
{
key: i + ' - 0',
data: {
name: 'Item ' + i + ' - 0',
size: Math.floor(Math.random() * 1000) + 1 + 'kb',
type: 'Type ' + i
}
}
]
};
files.push(node);
}
nodes.value = files;
2024-02-21 07:31:43 +00:00
2023-10-15 09:38:39 +00:00
<\/script>
`
2023-02-28 08:29:30 +00:00
}
};
},
2024-02-21 07:31:43 +00:00
methods: {
loadDemoData() {
let files = [];
2023-02-28 08:29:30 +00:00
2024-02-21 07:31:43 +00:00
for (let i = 0; i < 50; i++) {
let node = {
key: i,
data: {
name: 'Item ' + i,
size: Math.floor(Math.random() * 1000) + 1 + 'kb',
type: 'Type ' + i
},
children: [
{
key: i + ' - 0',
data: {
name: 'Item ' + i + ' - 0',
size: Math.floor(Math.random() * 1000) + 1 + 'kb',
type: 'Type ' + i
}
2023-02-28 08:29:30 +00:00
}
2024-02-21 07:31:43 +00:00
]
};
2023-02-28 08:29:30 +00:00
2024-02-21 07:31:43 +00:00
files.push(node);
}
2023-02-28 08:29:30 +00:00
2024-02-21 07:31:43 +00:00
this.nodes = files;
}
2023-02-28 08:29:30 +00:00
}
};
</script>