TransWikia.com

How to get child items from a DropTree (itemlink) path in JSS using React

Sitecore Asked by sitecorenerd on August 23, 2021

Is there a way to get child items from a droptree (itemlink) path in JSS using React without using GraphQL?

I see there are LayoutService but it only retrieves child from the contextItem or DataSource. I want to retrieve child item from the DropTree field on the template.

For example, I have Footer template where I have field Social Media Links Folder path which is DropTree field. So in JSS React code, I want to retrieve like

const Footer = (props) => {

  const model = props.fields ? props.fields : {}

  const child = model.socialLinks.children
}

One Answer

You can create your own custom resolver by inheriting RenderingContentsResolver Over ride ResolveContents method, get your data source item, which will have the droptree field. you can get the child/related items details and create your JObject item to return, as per your requirement.

Answered by Deepak Jena on August 23, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP