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.
问题:
回答1:
The Toolbar Searching has beforeSearch
event handler which can return false to stop searching. One can use this for validation of the data.
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
.
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.