reload master affer subgrid clone row

Questionsreload master affer subgrid clone row
Jorge Delfin Neri asked 7 years ago

Hello Abu
How can i trigge the update of the master grid when performin a clone action in the subgrid? i have tried with a custom function but i can get it work
 
function custom_clone($data)
{
function(){jQuery(‘#list2’).trigger(‘reloadGrid’,[{jqgrid_page:1}]); return [true, ”];}
}

Jorge Delfin Neri replied 7 years ago

hello, Any comments?

5 Answers
Jorge D answered 7 years ago

Hello , Any comments?

Wing answered 7 years ago

have a look at http://support.phpgrid.org/questions/2-grids-on-same-page-refresh-2nd-grid-with-javascript/

Jorge Delfin Neri replied 7 years ago

Hello Wing

I appreciate your willingness to help. My problem is specifically with the CLONE event that is not triggering the refresh in the master grid. The refresh in the onAfterSave, add_options,edit_options and delete_options Work flawless.

i have the code line

**grid_event** = “function(){jQuery(‘#list2’).trigger(‘reloadGrid’,[{jqgrid_page:1}]); return [true, ”];}”;

in each of these events and none triggers the refresh of the master grid( which is named list2)

regards

Abu Ghufran Staff answered 6 years ago

I missed this ticket somehow. The library does not have any event like onAfterClone.

We’ll be adding it in todos.

If you need it desperately, you can hack into lib/inc/jqgrid_dist.php and inject your code here:

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Sunny Kim answered 1 year ago

Hi.  Has the clone callback feature been implemented since then?  I\’m having a similar issue.  When a row is cloned, it\’s not obvious where to find the cloned row.  For adding a row, I managed to reload the grid in reverse order.  I\’m hoping to do the same with clone.   I tried this but didn\’t work.  It just reloads the grid with default sort order:   success: function( data ) { console.log(\”Success callback triggered.\”); jQuery(\”#\” + grid).jqGrid(\’setGridParam\’, { sortname: \’AUTO_ID\’, sortorder: \’desc\’ }); console.log(\”Sort parameters set.\”); jQuery(\”#\” + grid).trigger(\’reloadGrid\’); console.log(\”Grid reload triggered.\”); }

Abu Ghufran Staff answered 1 year ago

Hello,

Yes, onAfterClone JS event is added in latest build.

If you are already sorting the grid rows on auto-id desc, In order to reload grid and show latest row you just need to show the first page. The newly cloned row will be on top.

For that edit jqgrid_dist.php, find this code: fx_clone_row = function (grid,id) { … }
and inside this function, change

jQuery(“#”+grid).trigger(‘reloadGrid’,[{jqgrid_page:1}]);
to

jQuery(“#”+grid).trigger(‘reloadGrid’,[{page:1}]);

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

4 + 1 =

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?