如何在不直接插入文件jquery.jqGrid.src.js
?
示例:
ops: [
{"name": "eq", "description": "equal", "operator": "="},
{"name": "ne", "description": "not equal", "operator": "<>"},
{"name": "lt", "description": "less", "operator": "<"},
{"name": "the", "description": "less or equal", "operator": "<="},
{"name": "gt", "description": "greater", "operator": ">"},
{"name": "ge", "description": "greater or equal", "operator": "> ="},
{"name": "bw", "description": "begins with", "operator": "LIKE"},
{"name": "bn", "description": "does not begin with", "operator": "NOT LIKE"},
{"name": "in", "description": "in", "operator": "IN"},
{"name": "ni", "description": "not in", "operator": "NOT IN"},
{"name": "ew", "description": "ends with", "operator": "LIKE"},
{"name": "en", "description": "does not end with", "operator": "NOT LIKE"},
{"name": "cn", "description": "contains", "operator": "LIKE"},
{"name": "nc", "description": "Does not contain", "operator": "NOT LIKE"},
{"name": "noo", "description": "is null", "operator": "IS NULL"},
{"name": "nn", "description": "is not null", "operator": "IS NOT NULL"},
{"name": "xx", "description": "xxx", "operator": "CUSTOM"} ]
此更改正常,但您可以使用外部文件吗?
答案 0 :(得分:1)
首先,您应该了解添加自定义搜索运算符不遵循运算符的实现。我想你有服务器端实现的搜索。在搜索操作的扩展大多简单的情况下。
内部结构ops
将在下一版本的jqGrid中更改。因此,我建议您只需在<select>
内动态修改afterRedraw
选项。请查看the answer,this one或this one以获取相应的代码示例。在您的情况下,您可以使用
afterRedraw: function () {
$(this).find("table.group td.operators>select.selectopts")
.append("<option value='xx'>xxx</option>");
}
The demo使用上述afterRedraw
并显示
该演示使用 local datatype
,因此使用该操作进行搜索不是原因,但postData
参数将设置为对应于所选操作。