MultiSelect will not show TextField of Dictionary<int, ComplexEntity>

1 Answer 200 Views
MultiSelect
Zachary
Top achievements
Rank 1
Zachary asked on 28 Jun 2023, 04:06 PM | edited on 28 Jun 2023, 04:07 PM

I have a MultiSelect bound to a Dictionary<int, SerialNumberEntry> SNEList


<TelerikMultiSelect Data="SNEList" Value="@SelectedSerialNumberEntryIds" ValueExpression="@(() => SelectedSerialNumberEntryIds)" ValueChanged="@((List<int> newValues) => SelectSerialNumberEntryChanged(newValues))" AutoClose="false" Placeholder="Select Serial Numbers" ValueField="Key" TextField="Value.SerialNumber" @ref="SerialNumberMultiSelect" >
	<HeaderTemplate>
		<div class="select-all-item">
			<TelerikCheckBox TValue="bool"
				Value="@IsAllSerialNumbersSelected()"
				ValueChanged="@( (bool v) => ToggleSelectAllSerialNumbers(v) )"
				Id="ms-select-all-checkbox">
			</TelerikCheckBox>
			<label for="ms-select-all-checkbox">&nbsp;Select All</label>
		</div>
	</HeaderTemplate>
	<ItemTemplate>
		<input type="checkbox"
			id="@( "cb" + context.Key )"
			class="k-checkbox k-rounded-md k-checkbox-md"
			checked="@GetChecked(context.Value)">
		@context.Value.SerialNumber
	</ItemTemplate>
</TelerikMultiSelect>

and when I select an entry, it displays the "ToString()" result of the KeyValuePair<int, SerialNumberEntry>

Why does 

TextField="SerialNumber"

work if it's a List<SerialNumberEntry> but it's ignoring the 

TextField="Value.SerialNumber"

when it is a Dictionary<int, SerialNumberEntry>?  Can it not bind to child properties?  There's no template that I can find to override this behavior.

1 Answer, 1 is accepted

Sort by
0
Yanislav
Telerik team
answered on 03 Jul 2023, 10:26 AM

Hello Zachary,

At present, there is no template that allows modification of the MultiSelect tags. However, we have a feature request in our feedback portal to add a template for this purpose. Once this feature is implemented, you will gain the ability to modify the content within the tags.

I have added your vote to increase the popularity of this feature. We prioritize the implementation of feature requests based on community interest and demand.

You can also subscribe to receive email notifications about any changes to its status. This is the best way to stay updated on the progress of the feature. Once we determine which release will include its implementation, we will update the status in the feedback portal, and you will receive an email notification accordingly.

===

In the meantime, what I can suggest is to map the dictionary records to a collection of objects. By binding the MultiSelect to this collection, you can display the text field correctly. To illustrate this approach, here's an example in a REPL environment: https://blazorrepl.telerik.com/QdOBuRkM51JQaVPb42

Regards,
Yanislav
Progress Telerik

As of R2 2023, the default icon type will be SVG instead of Font. See this blogpost for more information.
Tags
MultiSelect
Asked by
Zachary
Top achievements
Rank 1
Answers by
Yanislav
Telerik team
Share this question
or