Cross site lookup field deployment
- Андрей Тарутин
- Posts: 13
- Joined: Mon Aug 25, 2014
Lookup column looks good and works fine. It's worth mentioning that in most cases data model provision (columns, content types, lists) is done within visual studio solutions. It could be xml provision or provision using API, depends on developer. How could I provision cross site lookup fields, let's say with xml provision? Could you provide a consistent example of your lookup field provision?
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hi Andrew,
Cross-site Lookup schema is similar to the out-of-the-box lookup but contains additional attributes. Here's an example:
So, you can provision it like any other field declaratively or programmatically.
Cross-site Lookup schema is similar to the out-of-the-box lookup but contains additional attributes. Here's an example:
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<Field
Type="Lookup"
Name="Country"
DisplayName="Country"
JSLink="~sitecollection/style library/plumsail/crosssitelookup/clienttemplates.js?field=Country"
xmlns:csl="Plumsail.CrossSiteLookup"
Mult="FALSE"
csl:ShowNew="false"
csl:RetrieveItemsUrlTemplate="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({LookupField}, '" + encodeURIComponent(term) + "')&$top=10";
}"
csl:ItemFormatResultTemplate="function(item) {
 return '<span class="csl-option">' + item["{LookupField}"] + '</span>'
}"
ID="{93c08653-b2e1-4342-b04f-8f32596b6633}"
SourceID="{fce5ae43-52aa-4f03-aa93-667112e7b5ce}"
StaticName="Country"
ColName="int1"
RowOrdinal="0"
Version="2"
WebId="{78a5e7dd-b782-4b2d-bf9a-893b5193d4ab}"
List="{275da0fb-d2cc-42c6-b82a-ed16ca87ea98}"
ShowField="Title"
csl:NewText="Add new item"
csl:NewContentType="" />
-
- Information
-
Who is online
Users browsing this forum: No registered users and 5 guests