Hello Synfusion,
We want to highlight the menu selected based upon route. I was referring to this answer:
https://www.syncfusion.com/forums/140629/apply-style-to-menu-selected
In this implementation only the first item is getting highlighted.
Is it possible to highlight subsequent items.
For example in the below Code if user selects "Distribution"( Adminstration-->Ranges-->Distributions)
https://stackblitz.com/edit/angular-e7ee1p-jguxbf?file=app%2Fapp.component.ts
then "Adminstration-->Ranges-->Distributions"
then all theses things should be highlighted.
I tried using the same control but it's not working properly
Hi Aravinthan,
Is there any update on this?
Thank You
public beforeOpen(args: BeforeOpenCloseMenuEventArgs): void {
for (let i = 0; i < args.items.length; i++) {
let childObj = args.items[i].items;
if (childObj.length > 0) {
for (let j = 0; j < childObj.length; j++) {
if (childObj[j].id === this.selectedSubMenuItem) {
args.element.children[i].classList.add('e-custom'); // set color for sub menu parent item
}
}
} else {
if (args.items[i].id === this.selectedSubMenuItem) {
args.element.children[i].classList.add('e-custom'); // set color for sub menu item
}
}
}
}
public onSelect(args: MenuEventArgs): void {
let text: string = args.item.text;
let isbreak: boolean = false;
let i = 0;
let customItem = this.menu.element.querySelector('.e-custom');
if (customItem) {
customItem.classList.remove('e-custom');
}
args.element.classList.add('e-custom');
this.selectedSubMenuItem = args.element.id;
..///
}
|