public refresh()

in packages/attribute-slicer/src/selection/JQuerySelectionManager.ts [193:231]


	public refresh(): void {
		const that = this;
		if (this.listEle) {
			// "function" important here
			// This is necessary because we need both the this context from the
			// event listeners, and reference to this calss
			this.listEle
				.selectAll(this.itemSelector)
				.on(EVENTS_NS, null) // Remove all the other ones
				.on(`selectstart${EVENTS_NS}`, () => false)
				.on(`mouseenter${EVENTS_NS}`, () => {
					const e = d3Selection.event;
					e.stopPropagation();
					this.itemHovered(this.eleItemGetter(select(e.currentTarget)));
				})
				.on(`click${EVENTS_NS}`, () => {
					const e = d3Selection.event;
					e.stopPropagation();
					this.keyPressed({ ctrl: e.ctrlKey, shift: e.shiftKey });
					this.itemClicked(this.eleItemGetter(select(e.currentTarget)));
				})
				.each(function() {
					const item: T = that.eleItemGetter(select(<HTMLElement>this));

					// This says, if we are brushing, then show the brushing selection,
					// otherwise show the real selection
					const isItemSelected: boolean =
						that.findIndex(
							item,
							that.internalDragging && that.brushMode
								? that.internalBrushingSelection
								: that.selection,
						) >= 0;

					// Add the selected class if it is selected
					select(this).classed("selected-slicer-item", isItemSelected);
				});
		}
	}