【发布时间】: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