Documentation for PickList
parent
1be6c04913
commit
72d83e9ed1
|
@ -135,7 +135,8 @@ export default {
|
||||||
this.$emit('reorder', {
|
this.$emit('reorder', {
|
||||||
originalEvent: event,
|
originalEvent: event,
|
||||||
value: value,
|
value: value,
|
||||||
direction: this.reorderDirection
|
direction: this.reorderDirection,
|
||||||
|
listIndex: listIndex
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -9,7 +9,7 @@ import OrderList from 'primevue/orderlist';
|
||||||
|
|
||||||
<h3>Getting Started</h3>
|
<h3>Getting Started</h3>
|
||||||
<p>OrderList requires an array as its value bound with the v-model directive and a template for its content.</p>
|
<p>OrderList requires an array as its value bound with the v-model directive and a template for its content.</p>
|
||||||
<p>Header of the component is defined with the "header" template and to define the content of an item in the list a named templated called "item" needs to be defined which gets the
|
<p>Header of the component is defined with the "header" template and to define the content of an item in the list a named template called "item" needs to be defined which gets the
|
||||||
<i>item</i> and the <i>index</i> via slotProps.
|
<i>item</i> and the <i>index</i> via slotProps.
|
||||||
</p>
|
</p>
|
||||||
<CodeHighlight>
|
<CodeHighlight>
|
||||||
|
@ -37,7 +37,7 @@ import OrderList from 'primevue/orderlist';
|
||||||
|
|
||||||
<CodeHighlight>
|
<CodeHighlight>
|
||||||
<template v-pre>
|
<template v-pre>
|
||||||
<OrderList v-model="cars" listStyle="height:auto" dataKey="vin" :dragdrop="true">
|
<OrderList v-model="cars" dataKey="vin" :selection.sync="selection">
|
||||||
<template #header>
|
<template #header>
|
||||||
List of Cars
|
List of Cars
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -4,19 +4,35 @@
|
||||||
<TabPanel header="Documentation">
|
<TabPanel header="Documentation">
|
||||||
<h3>Import</h3>
|
<h3>Import</h3>
|
||||||
<CodeHighlight lang="javascript">
|
<CodeHighlight lang="javascript">
|
||||||
import OrderList from 'primevue/orderlist';
|
import PickList from 'primevue/picklist';
|
||||||
</CodeHighlight>
|
</CodeHighlight>
|
||||||
|
|
||||||
<h3>Getting Started</h3>
|
<h3>Getting Started</h3>
|
||||||
<p>OrderList requires an array as its value bound with the v-model directive and a template for its content.</p>
|
<p>PickList requires a multidimensional array as its value bound with the v-model directive and a template for its content
|
||||||
<p>Header of the component is defined with the "header" template and to define the content of an item in the list a named templated called "item" needs to be defined which gets the
|
that gets the <i>item</i> instance and the <i>index</i> via slotProps.</p>
|
||||||
<i>item</i> and the <i>index</i> via slotProps.
|
|
||||||
</p>
|
|
||||||
<CodeHighlight>
|
<CodeHighlight>
|
||||||
<template v-pre>
|
<template v-pre>
|
||||||
<OrderList v-model="cars" header="List of Cars" listStyle="height:auto" dataKey="vin">
|
<PickList v-model="cars" dataKey="vin">
|
||||||
<template #header>
|
<template #item="slotProps">
|
||||||
List of Cars
|
<div class="p-caritem">
|
||||||
|
<img :src="'demo/images/car/' + slotProps.item.brand + '.png'">
|
||||||
|
<div>{{slotProps.item.brand}} - {{slotProps.item.year}} - {{slotProps.item.color}}</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</PickList>
|
||||||
|
</template>
|
||||||
|
</CodeHighlight>
|
||||||
|
|
||||||
|
<h3>Templates</h3>
|
||||||
|
<p>In addition to the mandatory "item" template, picklist provides "sourceHeader" and "targetHeader" slots as optional templates.</p>
|
||||||
|
<CodeHighlight>
|
||||||
|
<template v-pre>
|
||||||
|
<PickList v-model="cars" dataKey="vin">
|
||||||
|
<template #sourceHeader>
|
||||||
|
Available
|
||||||
|
</template>
|
||||||
|
<template #targetHeader>
|
||||||
|
Selected
|
||||||
</template>
|
</template>
|
||||||
<template #item="slotProps">
|
<template #item="slotProps">
|
||||||
<div class="p-caritem">
|
<div class="p-caritem">
|
||||||
|
@ -24,30 +40,25 @@ import OrderList from 'primevue/orderlist';
|
||||||
<div>{{slotProps.item.brand}} - {{slotProps.item.year}} - {{slotProps.item.color}}</div>
|
<div>{{slotProps.item.brand}} - {{slotProps.item.year}} - {{slotProps.item.color}}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</OrderList>
|
</PickList>
|
||||||
</template>
|
</template>
|
||||||
</CodeHighlight>
|
</CodeHighlight>
|
||||||
|
|
||||||
<h3>Selection</h3>
|
<h3>Selection</h3>
|
||||||
<p>In case you'd need to access the selected items in the list, define a binding to the <i>selection</i> property with the sync operator so that
|
<p>In case you need to access the selected items in the list, define a binding to the <i>selection</i> property with the sync operator so that
|
||||||
it gets updated when the user makes a selection. Since it is two-way binding enabled, your changes to the selection will be reflected as well. Note that
|
it gets updated when the user makes a selection. Since it is two-way binding enabled, your changes to the selection will be reflected as well. Note that
|
||||||
this is optional and only necessary when you need to access the selection.</p>
|
this is optional and only necessary when you need to access the selection.</p>
|
||||||
|
|
||||||
<p>Use the sync operator to enable two-way binding.</p>
|
|
||||||
|
|
||||||
<CodeHighlight>
|
<CodeHighlight>
|
||||||
<template v-pre>
|
<template v-pre>
|
||||||
<OrderList v-model="cars" header="List of Cars" listStyle="height:auto" dataKey="vin" :dragdrop="true">
|
<PickList v-model="cars" dataKey="vin" :selection.sync="selection">
|
||||||
<template #header>
|
|
||||||
List of Cars
|
|
||||||
</template>
|
|
||||||
<template #item="slotProps">
|
<template #item="slotProps">
|
||||||
<div class="p-caritem">
|
<div class="p-caritem">
|
||||||
<img :src="'demo/images/car/' + slotProps.item.brand + '.png'">
|
<img :src="'demo/images/car/' + slotProps.item.brand + '.png'">
|
||||||
<div>{{slotProps.item.brand}} - {{slotProps.item.year}} - {{slotProps.item.color}}</div>
|
<div>{{slotProps.item.brand}} - {{slotProps.item.year}} - {{slotProps.item.color}}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</OrderList>
|
</PickList>
|
||||||
</template>
|
</template>
|
||||||
</CodeHighlight>
|
</CodeHighlight>
|
||||||
|
|
||||||
|
@ -71,13 +82,13 @@ import OrderList from 'primevue/orderlist';
|
||||||
<td>value</td>
|
<td>value</td>
|
||||||
<td>array</td>
|
<td>array</td>
|
||||||
<td>null</td>
|
<td>null</td>
|
||||||
<td>Value of the component.</td>
|
<td>Value of the component as a multidimensional array.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>selection</td>
|
<td>selection</td>
|
||||||
<td>any</td>
|
<td>array</td>
|
||||||
<td>null</td>
|
<td>null</td>
|
||||||
<td>Selected items in the list.</td>
|
<td>Selected items in the list as a multidimensional array.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>metaKeySelection</td>
|
<td>metaKeySelection</td>
|
||||||
|
@ -119,9 +130,38 @@ import OrderList from 'primevue/orderlist';
|
||||||
<td>reorder</td>
|
<td>reorder</td>
|
||||||
<td>event.originalEvent: browser event <br />
|
<td>event.originalEvent: browser event <br />
|
||||||
event.value: Ordered list <br />
|
event.value: Ordered list <br />
|
||||||
event.direction: Direction of the change; "up", "down", "bottom", "top"
|
event.direction: Direction of the change; "up", "down", "bottom", "top" <br />
|
||||||
|
event.listIndex: Index of the list that is ordered, 0 represents the source and 1 represents the target list.
|
||||||
</td>
|
</td>
|
||||||
<td>Callback to invoke when the list is reordered.</td>
|
<td>Callback to invoke when the list is reordered.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>move-to-target</td>
|
||||||
|
<td>event.originalEvent: browser event <br />
|
||||||
|
event.items: Moved items
|
||||||
|
</td>
|
||||||
|
<td>Callback to invoke when one or more items are moved to the target list.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>move-all-to-target</td>
|
||||||
|
<td>event.originalEvent: browser event <br />
|
||||||
|
event.items: Moved items
|
||||||
|
</td>
|
||||||
|
<td>Callback to invoke when all items are moved to the target list.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>move-to-source</td>
|
||||||
|
<td>event.originalEvent: browser event <br />
|
||||||
|
event.items: Moved items
|
||||||
|
</td>
|
||||||
|
<td>Callback to invoke when one or more items are moved to the source list.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>move-all-to-source</td>
|
||||||
|
<td>event.originalEvent: browser event <br />
|
||||||
|
event.items: Moved items
|
||||||
|
</td>
|
||||||
|
<td>Callback to invoke when all items are moved to the source list.</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -139,18 +179,34 @@ import OrderList from 'primevue/orderlist';
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>p-orderlist</td>
|
<td>p-picklist</td>
|
||||||
<td>Container element.</td>
|
<td>Container element.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>p-orderlist-list</td>
|
<td>p-picklist-source-controls</td>
|
||||||
<td>List container.</td>
|
<td>Container of source list buttons.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>p-orderlist-item</td>
|
<td>p-picklist-target-controls</td>
|
||||||
<td>An item in the list</td>
|
<td>Container of target list buttons.</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
<tr>
|
||||||
|
<td>p-picklist-buttons</td>
|
||||||
|
<td>Container of buttons.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>p-picklist-listwrapper</td>
|
||||||
|
<td>Parent of a list element.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>p-picklist-list</td>
|
||||||
|
<td>List element.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>p-picklist-item</td>
|
||||||
|
<td>An item in the list.</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue