Interesting New Uses for SPDisplayRelatedInfo: Follow Up

1 minute read

Following up on my post Interesting New Uses for SPDisplayRelatedInfo, I’ve just added two new options to the SPDisplayRelatedInfo function in the first alpha for v0.4.7 of the jQuery Library for SharePoint Web Services.  The function is getting a little overloaded with options, but these two seemed pretty valuable yet not worth breaking things out into a new function.

 The two new options are:

numChars: 0,      // If used on an input column (not a dropdown), no matching will occur until at least this number of characters has been entered
matchType: "Eq",     // If used on an input column (not a dropdown), type of match. Can be any valid CAML comparison operator, most often "Eq" or "BeginsWith"

With these options, you can now use SPDisplayRelatedInfo more flexibly with columns which are not dropdowns or multi-selects, specifically Single line of text or Number columns.

By specifying a number of characters in numChars, you can limit the Web Services calls to find matching items in the relatedList from occurring until there have been at least that many characters typed.

By specifying a different value for matchType, you can change the type of comparison which is done to find matching items.  As noted above, the two most common values will be Eq and BeginsWith, however, there didn’t seem to be any reason not to allow all of the other available CAML comparison operators: Contains, Geq, Gt, Leq, Lt, Neq, etc.  You can see the descriptions for all of these CAML operators in the CAML Query Schema in the SDK on MSDN.



  1. Marc,

    I’m back to my task from the beginning of the week of an alphabetical list for a table of contents; as you’d pointed out, this looks like the best way to accomplish this. That said, I’m a little unsure how to do it as I want to do it outside of a form. I basically need to create a function (sortAlpha as an example) that fires your SPDisplayRelatedInfo call and prints the resulting output. As I’m just on a blank web part page and not in a form, do you have any thoughts on how to implement this (obviously outside of your intended application)?


    • Mike:

      I know that you are going to want to do this with the Web Services now that you are hooked, but I thought you’d be interested in a DVWP approach as well. Take a look at this post: Alpha Selection of List Items in a Data View Web Part (DVWP).

      OK, back to your actual question. You could obviously cobble this together by calling GetListItems directly yourself. However, this might be a nice little function for me to add to the jQuery Library for SharePoint Web Services.

      Methinks the function call might look something like this:

      	lookupListWebURL: "",
      	lookupList: "",
      	lookupListColumn: "",
      	lookupListColumns: [],
      	lookupListSortColumn: "",
      	displayFormat: "table",
      	headerCSSClass: "ms-vh2",
      	rowCSSClass: "ms-vb",
      	CAMLQuery: "",
      	completefunc: null,
      	debug: false

      Want to work on this together for the library?



Have a thought or opinion?