jqGrid navGrid search submit on Enter keypress not working

后端 未结 4 411
我在风中等你
我在风中等你 2020-12-22 00:12

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 00:59

    It seems to me that the problem cam be solved if you replace savekey: [true, 13] option which really not work for searching to the following beforeShowSearch and onClose event handle

    beforeShowSearch: function(form){
        form.keydown(function(e) {
            if (e.which == 13) {
                $(".ui-search", form).click();
            }
        });
    },
    onClose: function(form){
        form.unbind('keydown');
    }
    

    This method will work not only for the single field searching but for advance searching also.

    If you want that the 'Enter' key work only in the input fields you can replace form.keydown to $('.vdata',form).keydown and make the corresponding changes in the unbind.

提交回复
热议问题