Pierre GUILLAUME
Pierre GUILLAUME

Reputation: 449

Is there an event "on Refresh" for jqgrid navgrid

I try to find how to trigger an event before my grid refresh itself. Actually I need something like "onSearch" but for the reset button.

here is my code for navgrid :

    $("#jqGrid").jqGrid('navGrid','#jqGridPager' 
        ,{edit: false, add: false, del: false, search: true, refresh: true},// button of the footer : search and refresh
        {}, // settings for edit
        {}, // settings for add
        {}, // settings for delete
        {
            onSearch:function(){/*... first action ... */}, 
            /*   here :    afterRefresh: function(){console.log("refresh?");}, */
            multipleSearch:true,
            overlay:false, 
            sopt: ['eq']
         } // search options
    ); 

Does someone has an idea and/or documentation about navgrid events?

Thanks

Upvotes: 0

Views: 2672

Answers (1)

Oleg
Oleg

Reputation: 221997

You can use beforeRefresh and afterRefresh:

 $("#jqGrid").jqGrid('navGrid','#jqGridPager',
    {edit: false, add: false, del: false, search: true, refresh: true,
        beforeRefresh: function(){console.log("beforeRefresh");},
        afterRefresh: function(){console.log("afterRefresh");}},
    {}, // settings for edit
    {}, // settings for add
    {}, // settings for delete
    {
        onSearch:function(){/*... first action ... */}, 
        multipleSearch:true,
        overlay:false, 
        sopt: ['eq']
     } // search options
);

It's important to understand that navGrid just add buttons in the navigator bar. It calls some other methods of jqGrid on click on the most buttons. The options which you see in the "Searching" block are just the options of searchGrid method, which navGrid will use on click on the "Searching" button. There are no Refresh method, but there are exist "reloadGrid" event. navGrid calls the callbacks beforeRefresh and afterRefresh itself. It's the reason why beforeRefresh and afterRefresh are specified together with other options of navGrid.

Upvotes: 0

Related Questions