Hi Steve,
rolling up an old thread here, but as your reply here is 90% towards my goal, I'd thought I add it to this thread as others might find it useful:
I am looking for a small addition to your Gist, not sure how to apply filtering to the output/selection of categories, perhaps you can give me some advice?
Use case:
I have a content item (can be a company), and I have categories in two "main" categories (= top-level categories) contain "Awards" and "Brands" which in turn can contain an unknown number of sub-categories (see screenshot:
When I display all companies in a list or a single company in a detail page view, I'd like to not just show ALL categories it is assigned to (as your gist 4170872 provides the solution for), but separate the Awards from the Brands, see simplified screenshot here, where the "blue" parts show what I'd like to accomplish:
So if your code from the gist
<cfscript>
// Category Iterator of the CURRENT Content Node
itCats = $.content().getCategoriesIterator();
</cfscript>
could be extended like this:
<cfscript>
// Category Iterator of the CURRENT Content Node in SubCategory BRANDS with ID 9BB39004-3D78-42E4-B43B585A94BB9B49
itCatsBrands = $.content().getCategoriesIterator().where().prop('parentid').containsValue('9BB39004-3D78-42E4-B43B585A94BB9B49');
</cfscript>
it would do what I want - but that doesn't work :-)
(ideally, not using the category ID but its name, but I'm good if it works with just the ID too)
Many thanks for any hints!
Jonas