DEV Community

jerinraj5555
jerinraj5555

Posted on

How to add multiple rootPath in Coral 3 Pathfield?

As per the Adobe documentation rootPath of a Pathfield component only supports a string, not multiple strings, ie., only one rootPath. So we need to resolve this issue by overlay or extending this component/libs/granite/ui/components/coral/foundation/picker/picker.jsp but from 6.4 onward because picker is marked as granite: FinalArea(Defines a node as final then the Nodes are classified as final cannot be overlaid or inherited.), so we can't overlay.

Instead of enabling multiple root paths for a Pathfield, we can follow an alternate approach like choosing a desired root path from a selection list in the dialogue and on the basis of this selection, the root path of the Pathfieldcan be set.

  • First, we need to define some options in the select component. Here the options are /content/demo/en and /content/demo/fr. Image description
  • Next, we need to define the Pathfield component, after saving the dialogue you can see the below output. Image description
  • Put the below JavaScript snippet in your clientlibsfolder and then you can enable the rootPath set as per the selection.

Image description

Top comments (0)