I believe this is due to me data-binding twice, once on initialization for default and another after initialization. I am using both MVC and Javascript... but the javascript is in a different folder.
helper.Kendo().MultiSelect()
.Name(name)
.AutoClose(false)
.Value(selectedValue)
.Placeholder(placeholder)
.DataTextField(dataTextField)
.DataValueField(dataValueField)
.DataSource(
source =>
{
source.Read(read =>
{
read.Action(methodName, controllerName);
});
});
and
resourcesSelect.data("kendoMultiSelect").bind("select", selectAll);
After selecting them. When I click it's fine, however on hitting the "enter" key it fires off both selects and selects it twice. Am I looking in the right place? Or is it because of my handler method.
function selectAll(e) {
var dataItem = e.item;
var values = this.value();
if (dataItem.text() === "ALL") {
values = e.sender.dataSource.data().map(function (item) {
return item.value;
});
}
else {
var index = $.inArray("ALL",values);
if (index > -1) {
values.splice(index, 1);
}
}
this.value(values);
};