jqGrid navGrid search submit on Enter keypress not working

后端 未结 4 1530
走了就别回头了
走了就别回头了 2020-12-22 00:24

I\'d like to be able to invoke the find button on the search dialog when the \"Enter/Return\" key is pressed. Unfortunately the \'savekey\' option doesn\'t submit the form

4条回答
  •  执笔经年
    2020-12-22 01:05

    Try the following code. Works for me:

    beforeShowSearch: function(form){
       $(form).keydown(function(e) {
          if (e.keyCode == 13) {
             setTimeout(function() {
                $("#fbox_cust_grid_search").click();
             }, 200);
          }
       });
       return true;
    },
    onClose: function(form){
       $("#fbox_cust_grid_search").unbind('keydown');
    }
    

    There seems to be an issue when the click method is called too quickly. Giving the grid 200ms to do what it has to do before searching seems to do the trick.

提交回复
热议问题