Virath
Virath

Reputation: 11

Sitecore 8 - Extend the Multilist with Search controller

We have two problems with 'Multilist with Search' controller.

  1. How do we change the display field? Currently it shows something like below. 136330 (City item - Cities) we want to display the Display name + Language

is it possible?

  1. We have 4 different languages so, we need to filter it by the language as well. We found some resources which says that we can override it by implementing Sitecore.Buckets.FieldTypes.BucketList but we were not able to found a proper solution for these questions.

We already tried the below link but it only works on load but when we search a value the result is as mention in point 1.

How to get a Multilist with Search field to not display referenced items' version and language?

Waiting for a good answer?

Upvotes: 0

Views: 840

Answers (1)

Virath
Virath

Reputation: 11

Found the answers and just override the OutputString method as below for 1.

public override string OutputString(Item item) { return string.Format("{0} - {1}", (object)item.DisplayName,item.Fields["Postal code"].ToString()); }

And for 2 used the following code in the DoRender method.

using (new LanguageSwitcher(Sitecore.Context.Language)) sources = LookupSources.GetItems(current, this.Source);

Upvotes: 1

Related Questions