0
我有這些偉大的工作,爲navgrid設置,例如如下:我在哪裏設置closeAfterReset closeAfterSearch設置爲默認使用JqGrid?
this.Grid.navGrid('#' + this.PagerId, {}, {}, {}, {},
{
closeAfterSearch: true,
closeAfterReset: true,
closeOnEscape: true
});
,但我想他們被設置爲默認值。
我想:
$.extend($.jgrid.defaults, { search : { closeAfterReset: true } });
$.extend($.jgrid.search, { closeAfterReset: true });
...既不似乎工作。有小費嗎?
編輯:
這裏是我的代碼@Oleg建議 - 仍然沒有工作:
$.extend($.jgrid.search, {
closeAfterSearch: true,
closeAfterReset: true,
closeOnEscape: true,
beforeShowSearch: function ($form) {
...
},
onClose: function (searchBoxId) {
...
},
Reset: "Clear Filter",
Find: "Filter Grid"
});
據有關jqGrid的維基single_searching文章,搜索選項都在這裏設置,這是爲什麼我做了我的原代碼:
<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
個事件被擊中,但現在的屬性具有影響......
我會給這個鏡頭。語法'this.Grid.navGrid'是我自己的構造。我試圖創建一個用於我公司的標準「小部件」,所以我創建了一個包含jquery網格選擇器作爲屬性作爲快捷方式的對象。這就是爲什麼我尋求儘可能多地默認功能。我的目標是隻需編寫一個模型和我們創建的每個網格所需的任何額外功能,並在每個應用程序中具有標準的外觀和感覺。 – IronicMuffin
@IronicMuffin:我剛發現這個答案還沒有解決。所以我修改了一點我的演示從[答案](http://stackoverflow.com/questions/7394033/how-can-i-closeafterreset-using-single-search-on-jqgrid/7394598#7394598):[The新演示](http://www.ok-soft-gmbh.com/jqGrid/CloseAfterReset1.htm)設置屬性,我看到沒有問題。 – Oleg
看起來不錯。正如你在[其他問題]中看到的(http://stackoverflow.com/questions/7394033/how-can-i-closeafterreset-using-single-search-on-jqgrid/7394598#7394598)我問,我意識到在jqGrid中,closeOnReset無法正常運行。標記爲答案。謝謝! – IronicMuffin