Multiple TaxonomyControl's
Does Sitefinity 4.2 support multiple TaxonomyControl that operate on a single list. On the site i'm developing we have a list of documents, where each document is classified by different category hierarchies, say a Region category and a Division category. I want to be able to filter the document list by either or both of these categories.
Any suggestion?
Hello Emil,
Yes this can be done.
Add few categories to a document, then you can filter the download list widget based on those categories. I have attached a sample screenshot of the download list widget. You can select all categories you have or just a few.
In case you need to add more classifications I will describe you the steps that need to be taken to add one new category.
1. Go to Documents & Files module and click on Custom Fields(located in the right sidebar)
2. Create new custom field of type Classification and select one of the already available classifications, by default there are Categories, Tags, Departments. You can create new classification by going to Content->All Classifications and create a new one, it will appear in the dropdown when you create a new custom field or type Classification.
3. Save the new custom field
4. Edit one of the documents to add new classification to it.
Greetings,
Stanislav Velikov
the Telerik team
thanks Stanislav.
If I were place two Taxonomy widgets on the page with the download list how can i sort the list as the user makes selections from either of the two taxonomy controls?
Hi Emil,
The taxonomies controls have a functionality to filter based on only the selected taxonomy. For filtering based on multiple taxonomies you should create multiple taxonomy control.
Here is a sample on the API that is needed to get all taxonomies Guid`s and then filter them.
var tagA_Id =
new
Guid(
"47F632AE-BAD3-4F57-B293-38AC1F3DCC0E"
);
var tagB_Id =
new
Guid(
"BD1ECC6C-76F1-4538-804C-41DE67020C88"
);
var tagC_Id =
new
Guid(
"35F312A1-A274-49BC-A8C2-606E3211B44D"
);
var Cat1Id =
new
Guid(
"4B47DB31-F3EF-4040-9C95-58AC422B0EB5"
);
var Cat2Id =
new
Guid(
"20CF96A4-852C-4CB9-9C60-84BDFF8CA0EA"
);
var CatY_Id =
new
Guid(
"479D6F7B-D9D7-4E40-9A50-A9E2CF1CD039"
);
var content = App.WorkWith().BlogPosts().Where(bp => bp.Status == ContentLifecycleStatus.Live
&& (
(
bp.GetValue<TrackedList<Guid>>(
"Tags"
).Contains(tagA_Id))
&& bp.GetValue<TrackedList<Guid>>(
"Tags"
).Contains(tagB_Id)
&& bp.GetValue<TrackedList<Guid>>(
"Tags"
).Contains(tagC_Id)
)
&&
(
bp.GetValue<TrackedList<Guid>>(
"Category"
).Contains(Cat1Id)
|| bp.GetValue<TrackedList<Guid>>(
"Category"
).Contains(Cat2Id)
)
&&
(
bp.GetValue<TrackedList<Guid>>(
"Category"
).Contains(CatY_Id)
)
).Get().ToList();
Grid1.DataSource = content;
Grid1.DataBind();
This is exactly what I would like to do as well but am not sure where I should start. I need to make a new frontend sidebar which lists the available categories, departments, and markets, that I will cause the product list to display all matching products. What kind of control should I inherit from, TaxonomiesSidebar, DynamicCommandWidget?
This control should have a couple dropdownlists, one for each classification. Then that dropdown needs to databind to the list of values in that taxonomy. And finally have a submit button that somehow communicates the selected values to the ProductList for the filtered list.
Where can I find a walkthrough, video, or sample code to do each of these things? I've been looking all day and this is the closest post I have found.
thanks,
Steve
I am trying to do the exact same thing as Steve, multiple dropdowns based on categories that filter a list, in my case download list, and could also use a point in the right direction.