I use business pack treeview component for menu. What I want to archieve is that when I click on item Chleba
for example, it will redirect me to details of this category and also items Potraviny
and Pečivo
should be expanded. Both items must have this css class bp-state-expanded
. Right now when I am redirected to details, all items from treeview are collapsed
Below is sample of my category menu.
CategoryList
contains all categories which are displayed in treeview.
CategorySelectedList
contains single object where I clicked.
public List<CategoryListDTO> CategoryList { get; set; } = new List<CategoryListDTO>();
public List<CategoryListDTO> CategorySelectedList { get; set; } = new List<CategoryListDTO>();
Here is my redirect method to details
public void RedirectToCategory()
{
var details = CategorySelectedList.FirstOrDefault();
var productId = details.Id;
var productCategory = details.Name;
Context.RedirectToRoute(Routes.Product, new { ProductCategory = productCategory, Id = productId });
}
Is there a way how I can archieve this?
We have implemented auto-expanding of items in SelectedValues
collection. It will be available in a release coming later this month.