我有一个文本框和自动完成功能。如果用户输入自动填充功能,它会过滤结果并显示所需的结果,但是我想扩展它,将其他参数传递给自动填充程序,我该怎么做?
require(graphics)
with(cars, scatter.smooth(speed, dist))
## You can elaborate more on the line and dots as your will:
with(cars, scatter.smooth(speed, dist, lpars =
list(col = "red", lwd = 3, lty = 3)))
我知道JQuery-UI使用' term'用于过滤数据。
这是我的自动填充功能。
@Html.TextBoxFor(model => model.EmployeeName)
控制器:
@Html.LabelFor(model => model.Location)
@(Html.JQueryUI().AutocompleteFor(model => model.LocationId,
Url.Action((LocationsController c) => c.JsonSearch(null,model.EmployeeName)),
Html.IdFor(model => model.Location).ToString(),
Model.Location).MinLength(3).Delay(400))
答案 0 :(得分:0)
在我的情况下,我想传递用户输入的员工姓名
希望这会有助于其他人:)
$("#location").on("autocompletesearch", function (event, ui) {
var empName = $("#EmployeeName").val(); //passing employee name
var url = "@(Url.Action((LocationsController c) => c.JsonSearch(null,null)))";
if(empName) {
url += "?empname = " + empName;
}
$(this).autocomplete("option", "source", url);
});