How to use the igniteui-angular.IgxTextHighlightDirective.setActiveHighlight function in igniteui-angular

To help you get started, we’ve selected a few igniteui-angular examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github IgniteUI / igniteui-angular-samples / src / app / data-display / text-highlight / text-highlight-sample-1 / text-highlight-sample-1.component.ts View on Github external
private find(increment: number) {
        if (this.searchText) {
            this.matchCount = this.highlight.highlight(this.searchText, this.caseSensitive);
            this.index += increment;

            this.index = this.index < 0 ? this.matchCount - 1 : this.index;
            this.index = this.index > this.matchCount - 1 ? 0 : this.index;

            if (this.matchCount) {
                IgxTextHighlightDirective.setActiveHighlight("group1", {
                    index: this.index
                });
            }
        } else {
            this.highlight.clearHighlight();
        }
    }
}
github IgniteUI / igniteui-angular-samples / src / app / data-display / text-highlight / text-highlight-style / text-highlight-style.component.ts View on Github external
private find(increment: number) {
        if (this.searchText) {
            this.matchCount = this.highlight.highlight(this.searchText, this.caseSensitive);
            this.index += increment;

            this.index = this.index < 0 ? this.matchCount - 1 : this.index;
            this.index = this.index > this.matchCount - 1 ? 0 : this.index;

            if (this.matchCount) {
                IgxTextHighlightDirective.setActiveHighlight("group1", {
                    index: this.index
                });
            }
        } else {
            this.highlight.clearHighlight();
        }
    }
}
github IgniteUI / igniteui-angular-samples / src / app / data-display / text-highlight / text-highlight-sample-2 / text-highlight-sample-2.component.ts View on Github external
this.index = this.index < 0 ? this.matchCount - 1 : this.index;
            this.index = this.index > this.matchCount - 1 ? 0 : this.index;

            if (this.matchCount) {
                let row;

                for (let i = 0; i < matchesArray.length; i++) {
                    if (this.index < matchesArray[i]) {
                        row = i;
                        break;
                    }
                }

                const actualIndex = row === 0 ? this.index : this.index - matchesArray[row - 1];

                IgxTextHighlightDirective.setActiveHighlight("group1", {
                    index: actualIndex,
                    rowIndex: row
                });
            }
        } else {
            this.highlights.forEach((h) => {
                h.clearHighlight();
            });
            this.matchCount = 0;
        }
    }
}