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.