【问题标题】:ReferenceError: filterProducts is not defined which is a Javascript FunctionReferenceError: filterProducts 未定义,它是一个 Javascript 函数
【发布时间】:2013-11-22 08:51:52
【问题描述】:

我想使用这个 Javascript 函数“filterProduct”。 我想将它用于剑道下拉菜单::

@(Html.Kendo().DropDownList()
    .Name("ReferenceValue") //The name of the dropdownlist is mandatory. It specifies the "id" attribute of the widget.
    .DataTextField("ValidValue") //Specifies which property of the Product to be used by the dropdownlist as a text.
    .DataValueField("ReferenceValidValueID") //Specifies which property of the Product to be used by the dropdownlist as a value.
    .BindTo(Model)
            .DataSource(source =>
            {
                source.Read(read =>
                {
                    read.Action("GetReferenceValidValue", "GetData").Data("filterProducts"); //Set the Action and Controller name
                })
                .ServerFiltering(true); //If true the DataSource will not filter the data on the client.
            })
    .SelectedIndex(0) //Select first item.
)

<script>
    function filterProducts() {
        return {
            categories: $("#categories").val()
        };
    }
</script>

但是当我点击下拉菜单时,会抛出一个异常,

ReferenceError: filterProducts is not defined

请帮助我了解如何使用 Javascript 功能。

【问题讨论】:

    标签: jquery jquery-ui kendo-ui javascript


    【解决方案1】:

    您可以尝试将脚本标签移到 DropDownList 声明之前。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多