Cross Site Lookup Sorting
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hello,
Thank you for your request. Please, open Cross-site Lookup Manager and expand the Advanced settings section. In the Request items area you can find SharePoint data requests. Please, modify $orderby clause by replacing Created field with the internal name of the company name field. Here is an example:
Thank you for your request. Please, open Cross-site Lookup Manager and expand the Advanced settings section. In the Request items area you can find SharePoint data requests. Please, modify $orderby clause by replacing Created field with the internal name of the company name field. Here is an example:
Code: Select all
function (term, page) {
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id," +
"{LookupField}&$orderby=CompanyName&$top=10";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id," +
"{LookupField}&$orderby={LookupField}&$filter=startswith({LookupField}, '" + term + "')&$top=10";
}
I start with the following code, the dropdown works as expected, no sorting:
function (term, page) {
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby={LookupField}&$filter=startswith({LookupField}, '" + term + "')";
}
I make this change and the dropdown always shows "Searching...":
function (term, page) {
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}"$orderby=Title;
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby={LookupField}&$filter=startswith({LookupField}, '" + term + "')";
}
The column in the looked-up list is the Title field renamed to Relation. Please help.
function (term, page) {
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby={LookupField}&$filter=startswith({LookupField}, '" + term + "')";
}
I make this change and the dropdown always shows "Searching...":
function (term, page) {
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}"$orderby=Title;
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby={LookupField}&$filter=startswith({LookupField}, '" + term + "')";
}
The column in the looked-up list is the Title field renamed to Relation. Please help.
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hi,
It seems, you have a syntax error. Please, try to use the following code:
You can open the browser console and find the description of the error there.
It seems, you have a syntax error. Please, try to use the following code:
Code: Select all
function (term, page) {
if (!term || term.length == 0) {
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby=Title";
}
return "{WebUrl}/_api/web/lists('{ListId}')/items?$select=Id,{LookupField}&$orderby={LookupField}&$filter=startswith({LookupField}, '" + term + "')";
}
-
- Information
-
Who is online
Users browsing this forum: No registered users and 9 guests