86 lines
2.4 KiB
Vue
Executable File
86 lines
2.4 KiB
Vue
Executable File
<template>
|
|
<div>
|
|
<div class="content-section introduction">
|
|
<div class="feature-intro">
|
|
<h1>DataTable <span>Paginator</span></h1>
|
|
<p>Pagination is enabled by setting paginator property to true and defining the rows attribute as the number of rows per page.</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="content-section implementation">
|
|
<DataTable :value="cars" :paginator="true" :rows="10">
|
|
<Column field="vin" header="Vin"></Column>
|
|
<Column field="year" header="Year"></Column>
|
|
<Column field="brand" header="Brand"></Column>
|
|
<Column field="color" header="Color"></Column>
|
|
<template #paginatorLeft>
|
|
<Button type="button" icon="pi pi-refresh" />
|
|
</template>
|
|
<template #paginatorRight>
|
|
<Button type="button" icon="pi pi-cloud" />
|
|
</template>
|
|
</DataTable>
|
|
</div>
|
|
|
|
<div class="content-section documentation">
|
|
<TabView>
|
|
<TabPanel header="Source">
|
|
<CodeHighlight>
|
|
<template v-pre>
|
|
<DataTable :value="cars" :paginator="true" :rows="10">
|
|
<Column field="vin" header="Vin"></Column>
|
|
<Column field="year" header="Year"></Column>
|
|
<Column field="brand" header="Brand"></Column>
|
|
<Column field="color" header="Color"></Column>
|
|
<template #paginatorLeft>
|
|
<Button type="button" icon="pi pi-refresh" />
|
|
</template>
|
|
<template #paginatorRight>
|
|
<Button type="button" icon="pi pi-cloud" />
|
|
</template>
|
|
</DataTable>
|
|
</template>
|
|
</CodeHighlight>
|
|
|
|
<CodeHighlight lang="javascript">
|
|
import CarService from '../../service/CarService';
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
cars: null
|
|
}
|
|
},
|
|
carService: null,
|
|
created() {
|
|
this.carService = new CarService();
|
|
},
|
|
mounted() {
|
|
this.carService.getCarsLarge().then(data => this.cars = data);
|
|
}
|
|
}
|
|
</CodeHighlight>
|
|
</TabPanel>
|
|
</TabView>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import CarService from '../../service/CarService';
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
cars: null
|
|
}
|
|
},
|
|
carService: null,
|
|
created() {
|
|
this.carService = new CarService();
|
|
},
|
|
mounted() {
|
|
this.carService.getCarsLarge().then(data => this.cars = data);
|
|
}
|
|
}
|
|
</script> |