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.
- <dx-funnel
- (onItemClick)="onItemClick($event)">
- </dx-funnel>
- import { DxFunnelModule } from "devextreme-angular";
- // ...
- export class AppComponent {
- onItemClick (e) {
- e.item.select(!e.item.isSelected())
- };
- }
- @NgModule({
- imports: [
- // ...
- DxFunnelModule
- ],
- // ...
- })
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.
- import { ..., ViewChild } from "@angular/core";
- import { DxFunnelModule, DxFunnelComponent } from "devextreme-angular";
- // ...
- export class AppComponent {
- @ViewChild(DxFunnelComponent, { static: false }) funnel: DxFunnelComponent;
- // Prior to Angular 8
- // @ViewChild(DxFunnelComponent) funnel: DxFunnelComponent;
- clearSelection() {
- this.funnel.instance.clearSelection();
- }
- }
- @NgModule({
- imports: [
- // ...
- DxFunnelModule
- ],
- // ...
- })
See Also
User Interaction
When a user selects funnel items, they change their style to the one specified by the item.selectionStyle object.
- <dx-funnel ... >
- <dxo-item>
- <dxo-selection-style>
- <dxo-hatching direction="left"></dxo-hatching>
- </dxo-selection-style>
- </dxo-item>
- </dx-funnel>
- import { DxFunnelModule } from "devextreme-angular";
- // ...
- export class AppComponent {
- // ...
- }
- @NgModule({
- imports: [
- // ...
- DxFunnelModule
- ],
- // ...
- })
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.
- <dx-funnel ...
- (onSelectionChanged)="onSelectionChanged($event)">
- </dx-funnel>
- import { DxFunnelModule } from "devextreme-angular";
- // ...
- export class AppComponent {
- onSelectionChanged (e) {
- if (e.item.isSelected()) {
- // Commands to execute when the item is selected
- } else {
- // Commands to execute when the selection is cleared
- }
- };
- }
- @NgModule({
- imports: [
- // ...
- DxFunnelModule
- ],
- // ...
- })
See Also
If you have technical questions, please create a support ticket in the DevExpress Support Center.