在单字段搜索后,jqGrid是否只有任何回调?
只有在单击“搜索”按钮时才会触发onSearch回调,因此如果您想使用$("#grid").getGridParam('records');
获取搜索记录,则会获得先前请求的行数。
修改
这是我使用onSearch
onSearch:function(){
var ofilter = $("#competitors").getGridParam("postData");
var jqSearchQuery = "";
$.each(ofilter, function(key, val) { jqSearchQuery += key + '=' + val + '&' ;})
selectopts = new Array();
selectopts['cn'] = 'contiene';
selectopts['bw'] = 'empiece por';
selectopts['eq'] = 'igual';
selectopts['ne'] = 'no igual';
selectopts['lt'] = 'menor que';
selectopts['gt'] = 'mayor que';
selectopts['ew'] = 'termina por';
var records = $("#competitors").getGridParam('records');
searchResult = records+" resultados para la búsqueda <b>\""+ofilter.searchField+" "+selectopts[ofilter.searchOper]+" "+ofilter.searchString+"\"</b>";
$('#searchResult').html('<p>'+searchResult+'</p>');
}