Related Items: How to determine when its populated and ready to be read?

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
tharais
Posts: 11
Joined: Wed Mar 29, 2017

15 Aug 2019

Hi..
I'm using a related items control with a lookup field on my form to dynamically filter the related item results.
The setHash function from another thread is working great..

The issue I'm having is that I now want to read some of the fields from the related items row after calling the setHash function but the fd.relatedItems(0).data('ctx').ListData.Row[0].FieldName object is throwing an error saying its undefined or null.
I'm sure its because it hasn't fully completed the filtering process and its just not ready to be read yet.

Is there a callback or property of the related items control that I can look at to determine if the object has been created and is ready to be read?

Thanks a bunch..

TJ

User avatar
mnikitina
Posts: 264
Joined: Wed Jun 05, 2019

19 Aug 2019

Hello tharais,

You can try leveraging MutationObserver object to observe DOM changes inside the Related Items control. With its help, you can check if data is loaded and ready to be used.

Please see the article about MutationObserver for more information.

tharais
Posts: 11
Joined: Wed Mar 29, 2017

19 Aug 2019

thanks!.. I'll give that a try.

Appreciate the pointer..

TJ

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 24 guests