Kendo UI - Multiselect with remote data source

1

I've been busting my head with the multiselect kendo UI >. Whenever I return the list with the information of my action , the plugin can not understand the information and returns me the following error: Cannot read property 'value' of undefined . I've already tried turning it into javascript array, Json, and it will not at all. Here is the plugin's javascript code:

//Aplicar o filtro de Emails no campo de destinatários
$("#select-destinatarios").kendoMultiSelect({
    placeholder: "Selecione os destinatários...",
    dataTextField: "Email",
    dataValueField: "Id",
    autoBind: false,
    minLength: 3,
    filtering: function (e) {
        var filter = e.filter;
        if (!filter.value) {
            //prevent filtering if the filter does not value
            e.preventDefault();
        }
    },
    dataSource: {
        serverFiltering: true,
        transport: {
            read: {
                url: '../Alertbox/CarregarDestinatarios',
                dataType: 'json',
                data: function () {
                    return {
                        filtro: $("#select-destinatarios").data('kendoMultiSelect').input.val(), tipoDestinatario: $("#slc-tipo-envio").val()
                    };
                }
            }
        }
    }
});

On the server, return a List<object> with the properties Email and Id as shown in the code below:

if (!String.IsNullOrEmpty(filtro))
{
    Usuario usuario = new Usuario();
    Alertas = usuario.FiltroDestinatario(filtro, Id, tipoDestinatario);
}
else
{
    Alertas = new Dictionary<string, string>();
}

foreach(var item in Alertas)
{
    ListaFinal.Add(new
    {
        Email = item.Key,
        Id = item.Value
    });
}

return Json(ListaFinal, JsonRequestBehavior.AllowGet);

The problem is that after so much trying it worked with 1 record. When you brought more, you presented the error message above and even bringing only one record after that, the message persisted.

Can anyone help me?

    
asked by anonymous 15.02.2016 / 14:04

0 answers