【问题标题】:kendo ui combo box not sending requestskendo ui组合框不发送请求
【发布时间】:2014-06-24 23:59:13
【问题描述】:

我正在尝试让 Kendo UI 组合框在我键入时从服务器加载数据。 #Client 是一个输入框。我需要保存文本框中项目的 ID,这就是我使用组合框而不是自动完成的原因。当我在组合框中键入时,它总是在输入框中的数据后面发送 1 个按键的字符串。我认为发生这种情况是因为“阴影”Kendo UI 输入框在调用服务器之前不会更新原始输入框。

另外,如果我不使用 parameterMap 代码,在输入框中输入的任何内容都不会发送到服务器。而且,我希望过滤条件也会被发送。我查看了 Telriks 站点上的示例,它们显示使用请求参数中的过滤器来查看数据,但是当我使用 fiddler 或任何其他跟踪工具时,我可以看到请求中没有发送任何内容处理来自 Kendo UI 服务器调用的数据。这应该是相对容易的事情,但我很难过。

编辑:我将其更改为 kendoAutoComplete,一切正常,就像我期望 AutoComplete 一样。除了返回 dataValueField 之外,它与 ComboBox 的实现应该没有什么不同。

        $("#Client").kendoComboBox({
            dataTextField: "label",
            displayValueField: "id",
            suggest: true,
            autoBind: false,
            minLength: 1,
            highlightFirst: true,
            filter: "contains",
            dataSource: new kendo.data.DataSource({
                serverFiltering: true,
                transport: {
                    read: { url: "/search/client", dataType: "json", type: "POST" },
                    parameterMap: function (data) {
                        return { search: $("#Client").val() }
                    }
                }
            })
        });

【问题讨论】:

    标签: kendo-ui kendo-combobox kendo-ui-mvc


    【解决方案1】:
    $("#Client").kendoComboBox({
            dataTextField: "label",
            displayValueField: "id",
            suggest: true,
            autoBind: false,
            minLength: 1,
            highlightFirst: true,
            filter: "contains",
            dataSource: new kendo.data.DataSource({
                serverFiltering: true,
                transport: {
                    read: {
                       url: "/search/client", 
                       dataType: "json", 
                       type: "GET",
                       data: function () {
                         return { search: $("#Client").val() }
                       }
                    }
                }
            })
        });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-02-25
      • 1970-01-01
      • 2015-02-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多