Kendo UI 多选标记模式 - 根据键入的值进行过滤,不将键入的文本传递到服务器

Kendo UI Multiselect Tag mode - filter based on typed value not passing the typed text to server

这是我用来将多选绑定到 javascript 中的列表框的代码。我不在我想念的地方,我没有在 ajax 调用中收到键入的文本以获取值。该方法在控制器端被调用,我有 returns null.

的字符串参数

基于URL实施:https://demos.telerik.com/kendo-ui/multiselect/addnewitem

 $("#Tags").kendoMultiSelect({
                placeholder: "Select your tags",
                dataTextField: "Name",
                dataValueField: "Id",
                autoBind: false,
                maxSelectedItems: 5,
                minLength: 3,
                delay: 2000,
                //filter: "startswith",
                dataSource: {
                    transport: {
                        read: {
                            url: "/Support/Ticket/GetTags",
                            dataType: "json"
                        }
                    },
                    serverFiltering:true
                }
            });

控制器

public JsonResult GetTags(string text)
{
    List<Tag> tags = _tagRepository.GetAll(text).ToList();
    return Json(tags);
}

如此处https://www.telerik.com/forums/server-filtering-not-working-as-expected#KXcqO6xHoE6NxGuL0T2ZoQ所述,我认为您需要添加 return 数据选项

$(document).ready(function () {
           $("#products").kendoMultiSelect({
               placeholder: "Select products...",
               dataTextField: "ProductName",
               dataValueField: "ProductID",
               dataSource: {
                   type: "odata",
                   serverFiltering: true,
                   transport: {
                       read: {
                           url: "http://demos.kendoui.com/service/Northwind.svc/Products",
                           data: function () {                               
                               return {
                                   text: $("#products").data('kendoMultiSelect').input.val()
                               };
                           }
                       }
                   }
               }
           });
       });