Pregunta

Tengo Kendo Multiselect Control que funciona perfectamente bien. Sin embargo, me enfrento a un problema para restablecer su valor seleccionado. Lo siguiente es lo que he probado hasta ahora:

$("#Department option:selected").removeAttr("selected");  

Y

var departmentMultiselect = $('#Department').data("kendoMultiSelect");
var subtract = $('#department').val();
                var values = departmentmultiselect.value().slice();
                values = $.grep(values, function (a) {
                 return $.inarray(a, subtract) == -1;
                });
                departmentmultiselect.datasource.filter({});
                departmentmultiselect.value(values);  

En el segundo código, el control omite el siguiente código

values = $.grep(values, function (a) {
                     return $.inarray(a, subtract) == -1;
                    });  

¿Cómo puedo restablecer este control?

¿Fue útil?

Solución

Para deseleccionar todos los valores en Kendo Multiselect:

var multiSelect = $('#Department').data("kendoMultiSelect");
multiSelect.value([]);

Otros consejos

Tenía esta misma pregunta, pero quería eliminar solo un valor del múltiple selecto en lugar de todo. Esto es lo que se me ocurrió:

var multiselect = $('#multiSelectId').data("kendoMultiSelect");
var values = multiselect.value().slice();

// optionId is the value I want to remove
var index = $.inArray(optionId, values);
if (index > -1) {
    values.splice(index, 1);
}

multiselect.dataSource.filter({});
multiselect.value(values);

Establezca el valor multiselecto para el valor de su marcador de posición

var multiselect = $("#ICD10CodeIds").data("kendoMultiSelect");
        multiselect.value(0);
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top