Add selection

pull/104/head
cagataycivici 2019-10-22 10:51:04 +03:00
parent 5ffd624047
commit e9015d4db6
2 changed files with 8 additions and 0 deletions

View File

@ -915,6 +915,7 @@ export default {
<template v-pre> <template v-pre>
&lt;DataTable :value="cars" :paginator="true" :rows="10" :filters.sync="filters" :resizableColumns="true" &lt;DataTable :value="cars" :paginator="true" :rows="10" :filters.sync="filters" :resizableColumns="true"
stateStorage="session" stateKey="dt-state-demo-session"&gt; stateStorage="session" stateKey="dt-state-demo-session"&gt;
:selection.sync="selectedCar" selectionMode="single" dataKey="vin"
&lt;template #header&gt; &lt;template #header&gt;
&lt;div style="text-align: right"&gt; &lt;div style="text-align: right"&gt;
&lt;i class="pi pi-search" style="margin: 4px 4px 0px 0px;"&gt;&lt;/i&gt; &lt;i class="pi pi-search" style="margin: 4px 4px 0px 0px;"&gt;&lt;/i&gt;
@ -984,6 +985,7 @@ export default {
{name: 'Orange', value: 'Orange'}, {name: 'Orange', value: 'Orange'},
{name: 'Blue', value: 'Blue'} {name: 'Blue', value: 'Blue'}
], ],
selectedCar: null,
cars: null cars: null
} }
}, },

View File

@ -12,6 +12,7 @@
<div class="content-section implementation"> <div class="content-section implementation">
<h3>Session Storage</h3> <h3>Session Storage</h3>
<DataTable :value="cars" :paginator="true" :rows="10" :filters.sync="filters" :resizableColumns="true" <DataTable :value="cars" :paginator="true" :rows="10" :filters.sync="filters" :resizableColumns="true"
:selection.sync="selectedCar1" selectionMode="single" dataKey="vin"
stateStorage="session" stateKey="dt-state-demo-session"> stateStorage="session" stateKey="dt-state-demo-session">
<template #header> <template #header>
<div style="text-align: right"> <div style="text-align: right">
@ -53,6 +54,7 @@
<h3>Local Storage</h3> <h3>Local Storage</h3>
<DataTable :value="cars" :paginator="true" :rows="10" :filters.sync="filters" :resizableColumns="true" <DataTable :value="cars" :paginator="true" :rows="10" :filters.sync="filters" :resizableColumns="true"
:selection.sync="selectedCar2" selectionMode="single" dataKey="vin"
stateStorage="local" stateKey="dt-state-demo-local"> stateStorage="local" stateKey="dt-state-demo-local">
<template #header> <template #header>
<div style="text-align: right"> <div style="text-align: right">
@ -100,6 +102,7 @@
<template v-pre> <template v-pre>
&lt;h3&gt;Session Storage&lt;/h3&gt; &lt;h3&gt;Session Storage&lt;/h3&gt;
&lt;DataTable :value="cars" :paginator="true" :rows="10" :filters.sync="filters" :resizableColumns="true" &lt;DataTable :value="cars" :paginator="true" :rows="10" :filters.sync="filters" :resizableColumns="true"
:selection.sync="selectedCar1" selectionMode="single" dataKey="vin"
stateStorage="session" stateKey="dt-state-demo-session"&gt; stateStorage="session" stateKey="dt-state-demo-session"&gt;
&lt;template #header&gt; &lt;template #header&gt;
&lt;div style="text-align: right"&gt; &lt;div style="text-align: right"&gt;
@ -141,6 +144,7 @@
&lt;h3&gt;Local Storage&lt;/h3&gt; &lt;h3&gt;Local Storage&lt;/h3&gt;
&lt;DataTable :value="cars" :paginator="true" :rows="10" :filters.sync="filters" :resizableColumns="true" &lt;DataTable :value="cars" :paginator="true" :rows="10" :filters.sync="filters" :resizableColumns="true"
:selection.sync="selectedCar2" selectionMode="single" dataKey="vin"
stateStorage="local" stateKey="dt-state-demo-local"&gt; stateStorage="local" stateKey="dt-state-demo-local"&gt;
&lt;template #header&gt; &lt;template #header&gt;
&lt;div style="text-align: right"&gt; &lt;div style="text-align: right"&gt;
@ -211,6 +215,8 @@ export default {
{name: 'Orange', value: 'Orange'}, {name: 'Orange', value: 'Orange'},
{name: 'Blue', value: 'Blue'} {name: 'Blue', value: 'Blue'}
], ],
selectedCar1: null,
selectedCar2: null,
cars: null cars: null
} }
}, },