我在哪里将JqGrid的closeAfterReset closeAfterSearch设置设置为默认值? [英] Where do I set closeAfterReset closeAfterSearch settings as defaults with JqGrid?
问题描述
在导航设置方面,我的工作非常出色,如下所示:
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.
我尝试过:
-
$.extend($.jgrid.defaults, { search : { closeAfterReset: true } });
-
$.extend($.jgrid.search, { closeAfterReset: true } );
$.extend($.jgrid.defaults, { search : { closeAfterReset: true } });
$.extend($.jgrid.search, { closeAfterReset: true } );
...而且似乎都不起作用.有提示吗?
...and neither seem to be working. Any tips?
这是@Oleg建议的代码-仍然无法正常工作:
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"
});
根据jqgrid Wiki上的single_searching文章,在此处设置了搜索选项,这就是我执行原始代码的原因:
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>
对我来说有趣的是,我的onClose
和beforeShowSearch
事件被命中了,但是属性现在正在影响...
The funny thing to me is that my onClose
and beforeShowSearch
events are being hit, but the properties are having now affect...
推荐答案
默认搜索设置应设置为
$.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
}
);
做工完美.
它应该在jqGrid js文件之后和navGrid
调用之前执行.您使用的语法this.Grid.navGrid
似乎让我有些奇怪.
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.
这篇关于我在哪里将JqGrid的closeAfterReset closeAfterSearch设置设置为默认值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!