This project has moved and is read-only. For the latest updates, please go here.

Post processing with SPDisplayRelatedInfo

Dec 24, 2014 at 7:48 PM

Is there any way to find out if the SPDisplayRelatedInfo function actually returned related info? I would like to be able to display a custom hidden DIV or throw and alert box using the completeFunc argument, but only if results were actually returned.

Dec 29, 2014 at 2:59 PM
Edited Dec 29, 2014 at 3:05 PM
You could use the completefunc to inspect the div element that houses the return. The div element will have an ID something like "SPDisplayRelatedInfo_ColumnStaticName" where "ColumnStaticName" is the static name of your column. For instance, if you're returning the results as a simple table, you could inspect the table element within the div to see that it contains more than 1 row (the header row).
if($("#SPDisplayRelatedInfo_ColumnStaticName").find("tr").length > 1) {
    //Data returned, do something
Dec 29, 2014 at 6:57 PM
Perfect that's what I was looking for! Thanks Geoff!