2 grids on same page; refresh 2nd grid with javascript

Questions2 grids on same page; refresh 2nd grid with javascript
Wing Kam asked 7 years ago

Hi,
I have 2 grids on the same page and are not related. The 2nd grid is a report calculated based on the entries of the 1st and is referencing a sql view.
When there’s an update or input in the first table, how can I refresh the 2nd table? Is there a javascript script call that can be made?
Thanks

2 Answers
Richard Samson answered 7 years ago

If your second grid is called list2 you should be able to update it with the following Javascript:
jQuery(‘#list2’).trigger(“reloadGrid”,[{page:1}]);
The Q&A question below shows a few more examples of how to reload the grid, just adjust the name parameter to match your second grid:
How to reload/refresh grid using javascript code (e.g. button click)?

Wing Kam answered 7 years ago

Thanks Richard, it helped greatly to search thru all the questions and here is my solution:
$opt[“onAfterSave”] = “function(){jQuery(‘#grid_summary’).trigger(‘reloadGrid’,[{jqgrid_page:1}]); return [true, ”];}”;
$g->set_options($opt);
$out = $g->render(“grid_rr_discipline_plan”);  //first table
$out_summary = $g2->render(“grid_summary“);   //second table

 

Your Answer

1 + 5 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?