SPDisplayRelatedInfo completefunc

Oct 4, 2010 at 8:49 PM

I am having trouble with the "completefunc:" operation. If the display name of the target field has no spaces (as in "Region", it works well. In my case, the display name of the column I am working on has a space ("Employee Name"). I am able to display the related info OK but can't get the post-processing function I'm calling to work when the column's display name has spaces. is there a way to overcome this? Here's my example ("completefunc" is calling "CenterData"):

function CenterData() {
    $("#showRelated_Employee Name td:nth-child(3)").css("textAlign", "center");
}

Notice the space between "Emplyee" and "Name."  I've tried several ways of resolving this including brackets, %20, and using the Static Name but to no avail.

Coordinator
Oct 5, 2010 at 3:23 AM

gkoliver:

The SPDisplayRelatedInfo function adds ids to the new elements in the DOM in a predicatble way, as you can see in the documentation: The DIV is named "SPDisplayRelatedInfo_" + columnStaticName in case you need to do any post-processing. What this ends up looking like in your example above would be: <div id="SPDisplayRelatedInfo_Employee_x0020_Name">, assuming that you originally named your column 'Employee Name' when you set it up.

I did change this in v0.5.4 from "#showRelated_" + columnStaticName in order to be more consistent with the other SPServices functions. If you are using a version of SPServices prior to v0.5.6, I *highly* suggest that you upgrade.

M.