UniSelector multiple different ObjectTypes

Ryan Anthoney asked on January 14, 2020 11:08

Hi all,

I've got a control and I want the user to be able to select multiple nodes. The nodes available need to be filtered by their type (ObjectType) however they are not limited to a single type.

Is it possible to specify multiple ObjectTypes, comma separated for example?

Alternatively how would I produce a multi-selector of different types combined?

For visibility all I will be needing to obtain from this list is the nodeID's / URL's so nothing that would conflict between different object types.

Thanks, Luke

Recent Answers


Roman Hutnyk answered on January 14, 2020 15:49

Are you talking about objects (custom module classes, etc.) or actual pages?

If you need pages of certain types you should be able to use cms.document class (or cms.tree) - it should contain data columns you've mentioned.

0 votesVote for this answer Mark as a Correct answer

Ryan Anthoney answered on January 14, 2020 15:52

Hi Roman,

Just pages, I am able to achieve it by adding a WHERE statement around the documentNodePath but this isn't really ideal or sustainable. I tried using classname="your.Class" but there is no definition of className in the cms.document table.

I'll look at the CMS.tree table as you suggest

Thanks

0 votesVote for this answer Mark as a Correct answer

Roman Hutnyk answered on January 14, 2020 16:00

What about cms.tree? it contains [NodeClassID] column

0 votesVote for this answer Mark as a Correct answer

Dmitry Bastron answered on January 14, 2020 17:25

Hi Ryan,

Could you clarify please, are you developing your own custom control OR do you need to adjust the setting for UniSelector to do it for you?

0 votesVote for this answer Mark as a Correct answer

Dmitry Bastron answered on January 14, 2020 17:42

Actually, you were nearly there with WHERE and ClassName. I was able to set up an example. This is what you need:

  • Uni selector control
  • Object type: CMS.Document
  • Return column name: NodeGuid
  • Display name format: {%DocumentName%}
  • Selection mode: Multiple
  • Additional columns: ClassName
  • Where condition: ClassName in ('DancingGoatMvc.Article', 'DancingGoatMvc.Cafe')

Also, I'd recommend storing NodeGuid instead of NodeId as Kentico doesn't maintain IDs if you move items from one environment to another. If you store IDs and export-import pages (or use Staging application) you may end up with wrong pages selected.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.