public bindEvents()

in src/selectionBehavior.ts [99:134]


    public bindEvents(options: SampleSlicerBehaviorOptions, selectionHandler: ISelectionHandler): void {
        const slicers: Selection<FilterDataPoint> = this.slicers = options.slicerItemContainers;

        this.dataPoints = options.dataPoints;
        this.interactivityService = options.interactivityService;
        this.slicerSettings = options.slicerSettings;
        this.options = options;

        this.selectionHandler = selectionHandler;
        slicers.on("click", ( dataPoint: SampleSlicerDataPoint, _index: number) => {
            (d3Event as MouseEvent).preventDefault();
            this.clearRangeSelection();

            /* update selection state */
            selectionHandler.handleSelection(dataPoint, true /* isMultiSelect */);
            
            /* send selection state to the host*/
            let filterValues = SelectionBehavior.mapDataPointsToFilterValues(this.dataPoints.filter((dataPoint) => dataPoint.selected));

            if (filterValues.length === 0) {
                this.clearFilters();
            }
            else {
                let filter: IBasicFilter = {
                    $schema: "http://powerbi.com/product/schema#basic",
                    ...(new BasicFilter(
                        this.callbacks.getFilterColumnTarget(), 
                        "In",
                        filterValues 
                    ))
                };
                
                this.callbacks.applyFilter(filter);
            }
        });
    }