API
The selection capability is not provided out of the box, but it can be implemented using the onItemClick event handler. The following code gives an example for the scenario when a click on a funnel item selects it, and a subsequent click on the same item clears the selection. To check whether the funnel item is already selected, its isSelected() method is called.
- <template>
- <DxFunnel
- @item-click="onItemClick"
- />
- </template>
- <script>
- import DxFunnel from 'devextreme-vue/funnel';
- export default {
- components: {
- DxFunnel
- },
- methods: {
- onItemClick (e) {
- e.item.select(!e.item.isSelected())
- }
- }
- }
- </script>
In the previous code example, selection was cleared of a specific item. If you need to clear selection of all items, call the Funnel's clearSelection() method.
- <template>
- <DxFunnel ref="funnel" />
- </template>
- <script>
- import DxFunnel from 'devextreme-vue/funnel';
- export default {
- components: {
- DxFunnel
- },
- methods: {
- clearSelection () {
- return this.$refs.funnel.instance.clearSelection();
- }
- }
- }
- </script>
See Also
User Interaction
When a user selects funnel items, they change their style to the one specified by the item.selectionStyle object.
- <template>
- <DxFunnel ... >
- <DxItem ... >
- <DxSelectionStyle>
- <DxHatching direction="left" />
- </DxSelectionStyle>
- </DxItem>
- </DxFunnel>
- </template>
- <script>
- import DxFunnel, {
- DxItem,
- DxSelectionStyle,
- DxHatching
- } from 'devextreme-vue/funnel';
- export default {
- components: {
- DxFunnel,
- DxItem,
- DxSelectionStyle,
- DxHatching
- }
- }
- </script>
Events
When a funnel item's selection state is being changed, the Funnel raises the selectionChanged event that you can handle with a function. If the handling function is not going to be changed during the lifetime of the UI component, assign it to the onSelectionChanged property when you configure the UI component. To check whether a funnel item was selected or the selection was cleared, call the item's isSelected() method.
- <template>
- <DxFunnel
- @selection-changed="onSelectionChanged"
- />
- </template>
- <script>
- import DxFunnel from 'devextreme-vue/funnel';
- export default {
- components: {
- DxFunnel
- },
- methods: {
- onSelectionChanged (e) {
- if (e.item.isSelected()) {
- // Commands to execute when the item is selected
- } else {
- // Commands to execute when the selection is cleared
- }
- }
- }
- }
- </script>
See Also
If you have technical questions, please create a support ticket in the DevExpress Support Center.