Page 1 of 2
Cross-site lookup - 'Loading Failed' error
Posted: 26 Aug 2015
by kevyn
Hi there. I just installed a trial of Cross-site lookup for Sharepoint online (office 365) and added a new lookup to a list.
When I click the dropdown, it inputs all of the items from my list successfully, however if I try and enter text to search, it just says 'Loading error'
Please can anyone help?
Re: Cross-site lookup - 'Loading Failed' error
Posted: 26 Aug 2015
by Dmitry Kozlov
Please, open the browser console (F12). Do any notifications appear there while you're typing?
Re: Cross-site lookup - 'Loading Failed' error
Posted: 26 Aug 2015
by kevyn
The console shows:
GET
https://mydomain.sharepoint.com/sites/b ... 0601055288 400 (Bad Request)
this only happens when typing - if I use the mouse to select items from the drop down without searching it works ok
Re: Cross-site lookup - 'Loading Failed' error
Posted: 26 Aug 2015
by Dmitry Kozlov
Did you modify Request items in the Lookup Manager? Please, try to reset it.
Re: Cross-site lookup - 'Loading Failed' error
Posted: 26 Aug 2015
by kevyn
I did not edit the advanced options
Re: Cross-site lookup - 'Loading Failed' error
Posted: 26 Aug 2015
by kevyn
I think I can now see the problem - the column I'm using is a calculated column with the following value:
=[Project Number]&" - "&[Project Name]
It seems that the search will not work with this calculated column (if I change it to a regular list item it works).
Is there any work around for this please? thanks for your help
Re: Cross-site lookup - 'Loading Failed' error
Posted: 26 Aug 2015
by kevyn
it seems any kind of calculated field does not work - is this a bug?
Re: Cross-site lookup - 'Loading Failed' error
Posted: 27 Aug 2015
by Dmitry Kozlov
It seems that SharePoint REST api does not allow to filter by calculated fields but you can configure filtering by multiple regular fields with the help of 'Request item' template following way:
Code: Select all
function (term, page) {
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby=Created desc&$top=10";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby={LookupField}&" +
"$filter=startswith(field1, '" + encodeURIComponent(term) + "') or " +
"startswith(field2, '" + encodeURIComponent(term) + "')&$top=10";
}
Re: Cross-site lookup - 'Loading Failed' error
Posted: 27 Aug 2015
by kevyn
Ok so using your example, I replaced 'field1' and 'field2' with my column names from the lookup list, however I got the same results. Is there any other area I should replace?:
function (term, page) {
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby=Created desc&$top=10";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby={LookupField}&" +
"$filter=startswith(Project Number, '" + encodeURIComponent(term) + "') or " +
"startswith(Project Name, '" + encodeURIComponent(term) + "')&$top=10";
}
Re: Cross-site lookup - 'Loading Failed' error
Posted: 27 Aug 2015
by Dmitry Kozlov
Hi,
You need to use internal names of fields instead of titles:
https://social.msdn.microsoft.com/Forum ... oint-lists