问题描述:

I have a problem with my search function, when I use search on mouse click, it works perfect, but when I use search on Enter, not work first time when I search, but if I repeat the search on Enter for the same column it works.

So, when I search on Enter first time, it returns to me all the rows that don't have values in the column that I execute the search, and when I repeat, second time, the search action on Enter, it works perfect. I don't know why the search action has this strange behaviour.

jqGrid code: function for searchOnEnter:

var grid=$("#grid");

grid.jqGrid("navGrid", "#pager", {

add: false, edit: false, del: false, refresh: false, search: false

})

grid.jqGrid("navButtonAdd", "#pager", {

title:"Search",

buttonicon:"ui-icon-search",

caption: "",

onClickButton: function () {

grid.searchGrid({jqModal : true, multipleSearch:true, closeAfterSearch:false, closeAfterReset: false,

closeOnEscape: true , searchOnEnter: true, recreateForm:true });

$("#searchcntfbox_grid").on( "keydown", function(event){ //id of search contain box

if(event.which === $.ui.keyCode.ENTER){

$(event.target).trigger("change");

$('#fbox_grid_search').click(); // id of search/find button

}

});

}

相关阅读:
Top