避免在JqGrid工具栏中搜索特殊字符 [英] Avoid Special Characters Search in JqGrid Toolbar

查看:119
本文介绍了避免在JqGrid工具栏中搜索特殊字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经成功地使用Asp.Net构建了具有所有必需功能的Jq GRid,除了避免在工具栏搜索中使用Spl字符"功能.我试图找到工具栏的ID,但没有成功.谁能告诉我如何使用正则表达式之类的东西来拒绝输入某些Spl Char,例如"/,:,',\"以及其他几个字符.我不希望用户在工具栏搜索中输入这些字符.

I have successfully build Jq GRid with Asp.Net with all the required features except the one to "Avoid Spl Characters in Tool Bar Search" . I tried to find the ID of the toolbar but with no success. Can any one tell me how can we use Regular Expression like stuff to deny entering of Some Spl Char like "/,:,',\" and few others. I dont want the user to enter those char in tool bar search.

推荐答案

工具栏搜索具有beforeSearch事件处理程序,该事件处理程序可以返回false以停止搜索.可以使用它来验证数据.

The Toolbar Searching has beforeSearch event handler which can return false to stop searching. One can use this for validation of the data.

如果您想知道如何手动查找搜索字段,则应了解以下内容.搜索工具栏中字段的ID将由前缀"gs_"和列名构成.您还应该了解,工具栏不是<table>元素的一部分. jqGrid在<table>元素上建立了一些基础.例如,如果您的<table>具有id ="list",则将搜索工具栏作为子项(而不是直接子项)包含的div的名称为#gview_list.

If you do want to know how to find the searching field manually you should understand following. The ids of the fields in the searching toolbar will be constructed from the "gs_" prefix and the name of the column. You should also understand, that the toolbar is not a part of the <table> element. jqGrid build some dives over the <table> element. For example if your <table> has id="list", the name of the div which contain the searching toolbar as a child (not a direct child) are #gview_list.

已更新:我创建了一个示例为您服务.尝试在搜索字段中键入长度不超过5个字符的名称并输入文字,您会收到一条错误消息,搜索将停止.

UPDATED: I created an example for you. Try to type and text in the search field for names which is not 5 characters long and you receive an error message and the searching will be stopped.

这篇关于避免在JqGrid工具栏中搜索特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆