Post processing with SPDisplayRelatedInfo

Dec 24, 2014 at 6:48 PM
Marc,

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.

Nick
Dec 29, 2014 at 1:59 PM
Edited Dec 29, 2014 at 2: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
}
Geoff
Dec 29, 2014 at 5:57 PM
Perfect that's what I was looking for! Thanks Geoff!