1

I am using inlineNav as follows:

var inlineparams = { 
    addParams: {useFormatter:false},
    editParams: {extraparam: { 
                 "action": "ajaxgrid",
                 "subaction": "jqedit", 
                 "tableid": "sysbuglist",
                 "sessionid":"fd7c74d8-d3cb-102f-bd56-0015171f0bcc" 
             }},
    add:true,
    edit:true,
    save:true,
    cancel:true,
    aftersavefunc:reloadGrid};

$("#navgrid").jqGrid("inlineNav","#navgrid_bottompager", inlineparams);

So, I am using the add, edit, save, cancel buttons on the bottompager.

Question: How do I get control after a save to the server? Saving to the server is working well, I just want to refresh the grid after a save.

Justin Ethier
  • 127,537
  • 50
  • 225
  • 279
Greg Neid
  • 23
  • 1
  • 8

1 Answers1

2

From the source code for inline editing, you can see that there is no explicit aftersavefunc for inlineNav, either in the options or in the save button's callback:

if(o.save) {
    $($t).jqGrid('navButtonAdd', elem,{
        ...
        onClickButton : function () {
            var sr = $t.p.savedRow[0].id;
            if(sr) {
                ...
                if( $($t).jqGrid('saveRow', sr, o.editParams) ) {
                    $($t).jqGrid('showAddEditButtons');
                }
            } 
        }

However, you can pass aftersavefunc as part of editParams:

var inlineparams = { 
    addParams: {useFormatter:false},
    editParams: {extraparam: { 
                     "action": "ajaxgrid",
                     "subaction": "jqedit", 
                     "tableid": "sysbuglist",
                     "sessionid":"fd7c74d8-d3cb-102f-bd56-0015171f0bcc"},
                 aftersavefunc: reloadGrid},
    ...

That should do it. Just be aware that aftersavefunc will be invoked on edit as well as save, since both operations support this callback.

Justin Ethier
  • 127,537
  • 50
  • 225
  • 279
  • @GregNeid - Since you just created your account today... you should consider marking this as the accepted answer if it solved your problem. That way everyone else on SO knows that your question has been answered: http://stackoverflow.com/faq#howtoask – Justin Ethier Apr 10 '12 at 18:39
  • 1
    @JustinEthier: +1 from me. You can see additionally [here](http://meta.stackexchange.com/a/5235/147495) how to accept the answer. After you will have 15 reputation points you will get the right to vote up about 30 answers or questions **per day** which you find helpful. I recommend you to use the right because it helps other to find helpful information on the stackoverflow. – Oleg Apr 10 '12 at 19:14
  • @JustinEthier: You are welcome! Did you already seen that jqGrid 4.3.2 is [published](http://www.trirand.com/blog/?page_id=6) today? – Oleg Apr 10 '12 at 19:21
  • @Oleg - No, thanks for the update. Do you know if there are any examples for the *New event system*? – Justin Ethier Apr 10 '12 at 19:31
  • @JustinEthier: The changed were introduced based on [my suggestion](http://www.trirand.com/blog/?page_id=393/feature-request/usage-of-jquery-events-in-jqgrid-together-with-callback-functions-used-currently/#p25559). An example from the suggestion is [the demo](http://www.ok-soft-gmbh.com/jqGrid/SearchingToolbarSynchronization.htm). I will later modify the code of the demo and post some other examples which uses the feature. For example I plan rewrite example from [the answer](http://stackoverflow.com/a/8436273/315935) with the usage of new events. – Oleg Apr 10 '12 at 19:41
  • I loved the pdf from 2009. Anything like that planned for documentation? The grid is amazing and totally changes my approach to web development. – Greg Neid Apr 10 '12 at 20:51
  • @GregNeid - Do not believe another PDF is planned although I am not the person to ask. I find that most everything can be found on the wiki: http://www.trirand.com/jqgridwiki/doku.php?id=wiki:jqgriddocs . Although sometimes you have to dig into the code. Also, this link from Oleg explains accepting: http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work/5235#5235 – Justin Ethier Apr 10 '12 at 21:01