我有一个字段的下拉框和一个文本框搜索其他字段。我需要在一次搜索中组合这些搜索。下面的代码不会将两个搜索组合成单个搜索。我需要结合两个搜索结果并产生一个输出。我如何结合两种搜索?
function onSearch() {
var q = $("#textboxsearch").val();
var drop1;
var drop = $("#dropdown option:selected").val() == "" ?
q : ($("#dropdown").val() == "True" ? true : false);
var grid = $("#grid").data("kendoGrid");
grid.dataSource.query({
page: 1,
pageSize: 10,
filter: {
logic: "or",
filters: [
{ field: "Name", operator: "contains", value: q },
{ field: "Project", operator: "contains", value: q },
{ field: "Id", operator: "contains", value: q },
{ field: "Type", operator: "contains", value: q },
{ field: "Usage", operator: "contains", value: q },
{ field: "Builder", operator: "contains", value: q },
{ field: "Status", operator: "contains", value: q },
{ field: "Group", operator: "contains", value: q },
],
logic: "and",
filters: [
{ field: "IsActive", operator: "contains", value: drop }
]
}
});
}
答案 0 :(得分:0)
var drop = $("#dropdown option:selected").val() == "" ? q : ($("#dropdown").val() == "True" ? true : false);
用下面的
替换下面的行var drop = $("#dropdown").val();