display two columns in Manage Plumsail Lookup
Posted by RMIC - Oct 1 ’15 at 09:38
Hello,
I have in a list a Manage Plumsail Lookup.
How can I view two columns within this Manage Plumsail Lookup Show?
Currently I have under format Item:
function(item) {
return '<span class="csl-option">' + item["{LookupField}"] + '</span>'
}
I have the article "Setting up the view of results in Cross-Site Lookup Column" (http://formsdesigner.blogspot.de/2013/07/setting-up-view-of-results-in-cross.html) read, but I do not come forward.
I want me display two text columns.
Many thanks!
-
rostislavModeratorMember for: 7 years 9 months 1 day
To display values of two columns inside the Cross Site lookup dropdown box:
1. Add the fields to the Request query. Here I'm adding two fields called 'anothercolumn1' and 'anothercolumn2' to my query:
function (term, page) { if (!term || term.length == 0) { return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},anothercolumn1,anothercolumn2&$orderby=Created desc&$top=10"; } return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},anothercolumn1,anothercolumn2&$orderby={LookupField}&$filter=startswith({LookupField}, '" + encodeURIComponent(term) + "')&$top=10"; }
2. Add the fields to the item format function:
function(item) { return '<span class="csl-option">' + item["{LookupField}"] + ' ' + item['anothercolumn1'] + ' ' + item['anothercolumn2'] + '</span>' }
Note that the names of the fields must be InternalNames, not titles (you can check in Forms Designer the internal name for a field).
If you want to also display multiple values inside the actual box (not the dropdown list), then you can add a calculated field with a formula like this:
[anothercolumn1]&" - "&[anothercolumn2]
and use it as the lookup field.
If you then want to filter the result set based on multiple fields check the following forum thread, especially starting from message [#7] http://forum.spform.com/forms-designer-for-sharepoint-20/cross-site-lookup-loading-failed-error-34396
-
RMICMemberMember for: 7 years 8 months 27 days
[#1]: Thanks!