JQGrid searchrules and toolbar filtering error
I have a toolbar filter set up that works on a JQGrid of mine. We recently got a requirement to only allow integers into this field. I changed the colModel of the appropriate column in order to validate client side before a search takes place. After making the changes to the javascript, the behavior has not changed. Validation appears to not be taking place client side regardless of the input, which leads me to believe I have a misunderstanding of the search rules. Code below
Previous
colModel:[ ...,
{name:'version', search:true, stype:'text'}
,...,]
Post Change
colModel:[ ...,
{name:'version', search:true, stype:'text',searchrules:{required:true, integer:true}}
,...,]
Do search rules not apply to toolbar filtering? The documentation indicates that they would, unless I'm missing a line somewhere.
Thanks for looking!
The searchrules
will be used only in the searching dialog, but not in the searching filter. As the workaround beforeSearch callback function for the validation of the data. You can analyse this.p.postData
. If the searching data wrong you should display the error dialog do any other actions like adding 'ui-state-error' or 'ui-state-error-text' to the input with the wrong data and return true
. Returning
true value from the
beforeSearch` handler will prevent applying the searching requests.
上一篇: jQuery jqGrid中的日期格式
下一篇: JQGrid搜索规则和工具栏过滤错误