0
votes

I have a case where updating and saving certain columns in an Interactive Grid row result in some other rows being updated. By default, only the changed row will be refreshed and further changes to (now updated) rows would result in Current version of data in database has changed error. I managed to solve this issue by hooking a Dynamic Action on custom interactivegridsave (which fires after changes have been saved in Interactive Grid). The action itself is Execute JavaScript Code that executes this (note that region_static_id is a placeholder):

apex.region("region_static_id").widget().interactiveGrid("getActions").invoke("refresh");

This will fetch all the records correctly (including the updated ones) and redraw the Interactive Grid. Id'like the changes becoming visible without the redraw. I thought of iterating through the rows, updating each one of them by id using the row-refresh action, but I have no idea how it works (or at least how to invoke it properly). This action should be available as it is properly listed in a list of available actions that I get when i execute this:

apex.region("region_static_id").widget().interactiveGrid("getActions").list().forEach(function(a){console.log("Action Label: "+a.label+", Name: "+a.name+(a.choice!==undefined?", Choice: "+a.choice:""));});

So, the question is:

How can I refresh rows by invoking a row-refresh action in Interactive Grid?

Alternatives that refresh rows (preferably by specifying the row id) are also welcome.

1

1 Answers

1
votes

After further research I found an alternative way (which I'm not sure how hackish or stable it is, but it works). It seems you can refresh rows by getting the data grid model, which you then use to fetch all of the its records by using:

var model = apex.region("predmet_dg").widget().interactiveGrid("getViews").grid.model;
model.fetchRecords(model._data);

This way refreshes the data without causing the grid redraw.