My radmultiselect has many values along with the option "None". The user is allowed to select up to 5 values and currently can select None amongst those 5 values which doesn't make any sense. If the user selects None (88 in the code below), I would like to clear any other selections and reselect None (88). I currently have the following code, but I can't figure out how to actually select or deselect an item via javascript.
ASP.NET:
<telerik:RadMultiSelect ID="RadMultiSelect1" runat="server" DataValueField="value" DataTextField="text" RenderMode="Lightweight" Placeholder="Select..." AutoClose="false" Skin="Bootstrap" CssClass="radmultiselectstyle" TagMode="Single" Width="100%" AccessKey="B">
<ClientEvents OnSelect="onSelect" />
</telerik:RadMultiSelect>
JS:
<script type="text/javascript" id="telerikClientEvents1">
function onSelect(sender, args) {
var data = args.get_dataItem();
var multiSelectObject = $find("<%=RadMultiSelect1.ClientID %>");
var kendoMultiSelect = multiSelectObject.get_kendoWidget();
if (data.value == '88') {
/*[I would like to clear all values, reselect just 88, and, I'm guessing set
the MaxSelectedItems to one unless 88 is deselected]*/
}
}
</script>
Can anyone help?
Thanks!
I have made a little progress but it still is not working correctly.
multiSelect.value([""]); does clear all previously selected values like I want, but I was hoping that the next line, multiSelect.value(["88"]); would re-select 88. It does not.
Hi Rob, the correct method of the RadMultiSelect control is set_value(value), while the underlying widget's method is just value(value).