I don't use any callback function of the filterToolbar because all the callbacks will be called before the new grid body will be filled. The filterToolbar fill filters part of the postData, set the search parameter of jqGrid to true and trigger reloadGrid. So one should highlight the data inside of loadComplete (or gridComplete) callback because at the moment all data which should be highlighted are in the grid. So I used filterToolbar in the simple form$("#list1").jqGrid('filterToolbar', {stringResult: true, searchOnEnter: false, defaultSearch: 'cn'}); loadComplete的实现,您可以在下面找到:The implementation of loadComplete you find below:loadComplete: function () { var filters, i, l, rules, rule, iCol, $this = $(this); if (this.p.search === true) { filters = $.parseJSON(this.p.postData.filters); if (filters !== null && typeof filters.rules !== 'undefined' && filters.rules.length > 0) { rules = filters.rules; l = rules.length; for (i = 0; i < l; i++) { rule = rules[i]; iCol = getColumnIndexByName($this, rule.field); if (iCol >=0) { $('>tbody>tr.jqgrow>td:nth-child(' + (iCol + 1) + ')', this).highlight(rule.data); } } } }} 这篇关于jqGrid自动过滤器突出显示搜索结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-25 10:01