javascript - JqGrid tables reloading after editing and saving any row -


i have 4 jqgrid tables in php file , passsing different json array each grid tables.the data displaying on grid 1 table different sql conditions.

i using inline editing functionality grids , when edit , save row table1, want grids should refresh if row edited exists in next tables should vanished automatically. want reload grid tables after editing row in table. have written following code:

<table id="jqgrid"></table> <div id="pjqgrid"></div>  <table id="jqgrid1"></table> <div id="pjqgrid1"></div>  <table id="jqgrid2"></table> <div id="pjqgrid2"></div>  <table id="jqgrid3"></table> <div id="pjqgrid3"></div>  <script> pagesetup(); var myeditoptions = {     keys: true,     successfunc: function (response) {        // alert(json.stringify(response));          var msg=response.responsetext;         var n =msg.search("updated");         //alert(n);         if(n>=0)         {             $(".inner").html("<div class='alert alert-success fade in'>     <button class='close' data-dismiss='alert'>x</button><i class='fa-fw fa fa-thumbs-up'></i>  "+msg+" </div>");         }          else         {             $(".inner").html("<div class='alert alert-danger fade in'><button class='close' data-dismiss='alert'>x</button><i class='fa-fw fa fa-thumbs-down'></i>  "+msg+" </div>");               }         $("#jqgrid").trigger('reloadgrid');         $("#jqgrid1").trigger('reloadgrid');         $("#jqgrid2").trigger('reloadgrid');         $("#jqgrid3").trigger('reloadgrid');         jquery("#jqgrid").jqgrid('resetselection');         jquery("#jqgrid1").jqgrid('resetselection');         jquery("#jqgrid2").jqgrid('resetselection');         jquery("#jqgrid3").jqgrid('resetselection');         return true;          },     errorfunc: function (rowid,response) {         //alert(rowid);     },     afterrestorefunc:function (rowid,response) {         jquery("#jqgrid").jqgrid('resetselection');     }  }; </script> 

it recommend use aftersavefunc instead of successfunc reloading of grids. should place .trigger("reloadgrid") inside of settimeout. allows to finish processing of editing before starting reloading:

var myeditoptions = {     keys: true,     aftersavefunc: function () {         settimeout(function () {             $("#jqgrid,#jqgrid1,#jqgrid2,#jqgrid3").trigger("reloadgrid");         }, 50);     },     ... }; 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -