More checkboxes in PCF! As a TreeView this time

By | June 26, 2019

 

Did you ever have to tag records? What if we could organize those tags into a hierarchy, and, then, present them as a tree so the user could check off a few tags to identify the record?

Maybe it would look somewhat similar to this – at the top, there is a tree version, and at the bottom there is a usual subgrid:

And, yes, that’s PCF in action again.

If you wanted to try the control, you can download solution from github:

https://github.com/ashlega/ITAintBoring.PCFControls

There are two more controls there, and, if you need the source codes, they are all there as well.

But how do you set it up?

1. Create an entity for the tags

image

Set up a hierarchy for that entity by creating a self-referencing lookup field(see above) and making that a hierarchy relationship(see below):

image

The hierarchy is not required, but that’s what you can use later when you need to find all records “under” one of the parent tags, for example.

2. Create an N:N relationship between the entity you want to tag and the tags entity

image

3. Add a few tags, organize them into a hierarchy

image

4. Add a subgrid to the form for the entity you’ll be tagging

image

image

5. Set up Tree Relationships control for that subgrid

image

image

I think this can be improved a little more – technically, I might be able to get either the relationship name or the relationship entity name through a webapi call. For now, though, all 6 attributes should be set.

Save, publish, and enjoy the results.

PS. Any known issues you might ask? Right now, when selecting a section in the example above, all the paragraphs will be selected as well, but only the section tag will be linked to the record. And there is a similar issue around “deselecting”. That’s to be fixed soon.

PPS. Update (June 27) – that issue above has been fixed.

 

 

One thought on “More checkboxes in PCF! As a TreeView this time

  1. Daif

    This is pretty cool. Been wanting to use something like this for a Customer Asset related requirement (Nested Assets)

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *