开发者

Where do I set closeAfterReset closeAfterSearch settings as defaults with JqGrid?

开发者 https://www.devze.com 2023-04-01 03:46 出处:网络
I had these working great as navgrid settings like follows: this.Grid.navGrid(\'#\' + this.PagerId, {}, {}, {}, {},

I had these working great as navgrid settings like follows:

this.Grid.navGrid('#' + this.PagerId, {}, {}, {}, {},
{         
    closeAfterSearch: true,
    closeAfterReset: true,
    closeOnEscape: true      
});

but I would like them to be set as defaults.

I tried:

  • $.extend($.jgrid.defaults, { search : { closeAfterReset: true } });
  • $.extend($.jgrid.search, { closeAfterReset: true } );
  • 开发者_开发知识库

...and neither seem to be working. Any tips?

EDIT:

Here is my code as @Oleg suggested - still not working:

$.extend($.jgrid.search, {    
            closeAfterSearch: true,
            closeAfterReset: true,
            closeOnEscape: true,
            beforeShowSearch: function ($form) {
            ...
            },
            onClose: function (searchBoxId) {
             ...
            },
            Reset: "Clear Filter",
            Find: "Filter Grid"
        });

According to the single_searching article on the jqgrid wiki, search options are set here, which is why I did my original code:

<script>
...
jQuery("#grid_id").jqGrid({
 ...
pager : '#gridpager',
...
}).navGrid('#gridpager',{view:true, del:false}, 
{}, //  default settings for edit
{}, //  default settings for add
{},  // delete instead that del:false we need this
{search_options}, // search options  
{} /* view parameters*/
);
...
</script>

The funny thing to me is that my onClose and beforeShowSearch events are being hit, but the properties are having now affect...


The default searching settings should be set by

$.extend($.jgrid.search,
    {closeAfterSearch: true, closeAfterReset: true, closeOnEscape: true});

I don't tested exactly such settings, but my standard settings

$.extend(
    $.jgrid.search,
    {
        multipleSearch: true,
        multipleGroup: true,
        recreateFilter: true,
        closeOnEscape: true,
        overlay: 0
    }
);

work perfect.

It should be executed after jqGrid js-files and before the navGrid call. The syntax this.Grid.navGrid which you use seems me a little strange.

0

精彩评论

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