Reload Grid after on_update event

QuestionsReload Grid after on_update event
mofel asked 8 years ago

Hello,

To edit grid, i'm using on_update event with this:
$e["on_update"] = array("my_function", null, false);

I'm trying to reload the grid after update with the following option but it doesn't work:
$opt["reloadedit"] = true;
$opt["edit_options"]["reloadAfterSubmit"]=True;
$opt["edit_options"]["afterSubmit"] = "function(){jQuery('#list1').trigger('reloadGrid',[{current:true}]); return [true, ''];}";

Is the any special things to do when i use on_update event ?

Thanks

7 Answers
mofel answered 8 years ago

I just saw that even if i click on "reload button" on the grid it doesn't work.

I load the grid from an array.
Do the reload features work when we load grid from an array ?

Thanks
Mofel

Abu Ghufran answered 8 years ago

Loading grid from array cache all data in local JS variable, so reload will not be apparent.
If you want to fetch data again from server then some custom php / js / ajax code would be required.

If you can email me your grid code, i can suggest the changes.

selectcas.biz answered 6 years ago

HEllo Abu i have two grids in the same page, im triying to refresh the second grid after bulk edit in the first grid but it is not reloading the second grid:

i already tried this:

$grid["bulkedit_options"]["afterShowForm"] = "function(){jQuery('#list2').trigger('reloadGrid',[{current:true}]);}";

i also tried by creating a custom fuction and calling the reloadGrid but it neither work:

$e["on_update"] = array("refresh","",true);

$g->set_events($e);

function refres($data)
{
jQuery('#list2').trigger('reloadGrid',[{current:true}]); // if i add this line the page wont even load.

}

https://pastebin.com/Ahd9xG10

Abu Ghufran answered 6 years ago

Try:

$grid["bulkedit_options"]["afterShowForm"] = "function(){ jQuery('#sData').click( function(){ jQuery('#list2').trigger('reloadGrid',[{current:true}]); } ); }";

Binded refresh code on submit button click event.
You can put alert() before reloadGrid line to debug.

selectcas.biz answered 6 years ago

I added the line that you suggested and the second grid is still not refreshing.I dont get it why if i put this line

jQuery('#list2').trigger('reloadGrid',[{current:true}]);

within the function trigered by the custom button the page wont load, if i take it off the rest of the code within the function works properly.

https://pastebin.com/zmGBJb31

Abu Ghufran answered 6 years ago

You can try debugging it by alerting something. Also check browser error console for error. (F12)
$grid["bulkedit_options"]["afterShowForm"] = "function(){ jQuery('#sData').click( function(){ alert('test'); } ); }";

If your solution is online, then share online url.

selectcas.biz answered 6 years ago

Thanks Abu , as you suggested the refresh timeout did the trick.

"A quick hack could be to refresh grid after some timeout, e.g."

fx_bulk_update(……..
setTimeout(function(){jQuery('#list2').trigger('reloadGrid',[{jqgrid_page:1}]);},1000);";

Your Answer

0 + 7 =

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?