Page 1 of 1

Show Doc-Type-Icon in Cross-site Lookup

Posted: 20 Feb 2019
by RMIC
Hello,

how is it possible to display the document type as an icon (doc, pdf, folder icon etc.) when select in cross site lookup?

Show as more column does not work.

Thank you!

Re: Show Doc-Type-Icon in Cross-site Lookup

Posted: 21 Feb 2019
by AlexZver
Hi!

Please check out this article, it's very close to your issue: https://spform.com/cross-site-lookup/se ... office-365

Re: Show Doc-Type-Icon in Cross-site Lookup

Posted: 22 Feb 2019
by RMIC
This link is helpful. Thank you.

However, it does not work yet. In the code I have replaced my column "Type". However, no results are displayed in the Cross ite Lookup.

My code:

Request items:

Code: Select all

function (term, page) {
  if (!term || term.length == 0) {
    return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Dokumentennummer,Type&$filter=startswith(ContentTypeId, '0x0101')&$orderby=Created desc&$top=10";
  }
  return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField},Dokumentennummer,Type&$orderby={LookupField}&$filter=(substringof('" + encodeURIComponent(term) + "',Dokumentennummer) or substringof('" + encodeURIComponent(term) + "',{LookupField}))&$top=10";
}
Item format:

Code: Select all

function(item) {
  return '<div style="clear: both; height: 25px;">' +
    '<div style="width: 45px; float: left;"><img style="margin-top: 3px;" src="' +item.Type.Url + '"></div>' + item["{LookupField}"] + '</div>';
}
Thanks.

Re: Show Doc-Type-Icon in Cross-site Lookup

Posted: 26 Feb 2019
by Nikita Kurguzov
Dear RMIC,
For this code to work, you need to have an Image column, with Internal Name Type. Do you have one? Make sure it's Internal Name is correct.

Also, if Cross-site Lookup gives an error, please, open browser's console, check for errors and send us a screenshot.

Re: Show Doc-Type-Icon in Cross-site Lookup

Posted: 27 Feb 2019
by RMIC
Hello Nikita,

I do not have a picture column. I want to show the default SharePoint column "Type" in cross site lookup. The "Type" column shows the document type icon in a library (see also picture).

The code from the top gives me a "Loading failed" in the cross-site lookup, but no error in the Browser Console.

Thanks!

Re: Show Doc-Type-Icon in Cross-site Lookup

Posted: 28 Feb 2019
by AlexZver
Dear RMIC,

The only way to implement this is described in this article, I hope you'll find it useful: https://spform.com/cross-site-lookup/se ... office-365