I have a ListGrid, set to a DataSource:
DataSource requests = DataSource.get("REQUESTS");
ListGrid listGrid = new ListGrid();
listGrid.setDataSource(requests);
The DataSource references some foreign tables/fields, e.g.,
<field name="NAME" tableName="EMPLOYEE"></field>
So far so good, the ListGrid populates columns with data from both the native “requests” DS and the referenced foreign “employee” DS.
I have an “approve” button with an action to do a SQL UPDATE for the native requests.STATUS field in the currently selected ListGrid records:
for (i...
selectedRecords[i].setAttribute("STATUS", "approved");
listGrid.updateData(selectedRecords[i]);
The issue:
When viewing the ListGrid during the update, the “STATUS” field in the record(s) is updated as expected with the desired AJAX slickness. However, for the records that have been updated, the ListGridField cells that get their data from the foreign employee.NAME go blank.
If I force a refresh of the ListGrid either by browser F5 or
listGrid.invalidateCache();
…the NAME cells again display their values.
But this loses the desired AJAX “no-refresh” behavior. I’d like the employee.NAME cell data to remain in view like the other requests.* fields.
How best to approach this?