Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Force a refresh of an optionDataSource

$
0
0
SmartClient Version: v9.1p_2014-04-29/Pro Deployment (built 2014-04-29)

Firefox 26

Scenario:

ListGrid with a ListGridField attached to an optiondatasource to show a "displayField" for an ID column.

When grid first loaded there are no records for optiondatasource so RPC fetch correctly retrieves nothing.

An "Add" operation is performed on a different datasource that generates some records that are relevant to the optiondatasource. (A file upload that generates some parent records for a bunch of child records if the parent records do not already exist).

When a new search is performed and records are returned to the ListGrid, only the ID field is displayed instead of the "displayField" - presumably because the optiondatasource doesn't know there are now matching records for it to get and hasn't refreshed it's cache?

What is the correct way to force a refresh of the optiondatasource 'cache' so it picks up the new records? I have verified that the optiondatasource mapping works for the column by restarting Jetty and performing a search, and as expected the "displayField" value is shown instead of the ID value.

I am hoping there is a server-side way to trigger a re-fetch of the optiondatasource. I have looked through the API and the forum and found references to addRelatedUpdate(). The Javadoc seemed to fit my use-case so I tried this out to no avail...

Code:

DSResponse response = new DSResponse()

// Do file upload and generate some records relevant to optiondatasource

DSResponse relatedResponse = new DSResponse();
DataSource ds = DataSourceManager.getDataSource("optionDataSourceDS");
relatedResponse.setDataSource(ds);
relatedResponse.setOperationType(OP_ADD);

response.addRelatedUpdate(relatedResponse);

I'm not entirely sure about my use of DataSourceManager in this scenario, but if this is incorrect, can you please direct me to the right API to accomplish what I'm trying to do?
Thanks!

Viewing all articles
Browse latest Browse all 4756

Trending Articles