开发者

$.jgrid.nav in jqgrid for jquery

开发者 https://www.devze.com 2022-12-31 02:26 出处:网络
I have two different jqGrids in the same page. In the first grid I\'ve set custom functions for the add and edit buttons in the navigator bar, using the following code:

I have two different jqGrids in the same page. In the first grid I've set custom functions for the add and edit buttons in the navigator bar, using the following code:

$.jgrid.nav.addfunc = 
                    function() {
                         $('#btninsreset').click();
                    };
$.jgrid.nav.editfunc =
                    function(id) {
                        editUscita(id);
                    };

In the second grid I'd like to have the default behaviour, but I get the same seetings as the first grid instead. How may I reset the navigator to the 开发者_Python百科default settings for the second jqgrid? Thank you


Setting of $.jgrid.nav.addfunc change the global settings, so you can not use this if you want to have two jqGrids on the same page. The easiest way to solve the problem is setting of addfunc and editfunc as parameters of the first grid:

jQuery('#grid1').jqGrid({
    // ...
    '#pager1'
}).jqGrid ('navGrid', '#pager1', {
                                  addfunc: function() {$('#btninsreset').click();},
                                  editfunc: function(id) {editUscita(id);}
                                 });


I'v done it: I simply have to set $.jgrid.nav.addfunc = null;

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号