Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

  • Isomorphic
    replied
    ListGrid.invalidateCache() would not be expected to clear caches related to listGridField.optionDataSource, since it's a separate DataSource, so there's no indication that the cached data has become invalid.

    Use DataSource.updateCaches() to publish updates to the data in the optionDataSource, inclusive of the ability to just invalidate all caches as describes in the docs for that method.

    Leave a comment:


  • DataSource client cache invalidation and ListGridField optionDataSource

    Hi,

    We're using SmartGWT 4.1 Power Edition (v9.1p_2014-06-04).
    I'm facing a problem regarding DataSources with cacheAllData set to true and ListGridField using such data sources as optionDataSource.

    Scenario:
    - 2 users connected to the application.
    - 1st one performs an update operation on cached data source.
    - 2nd user client is notified of operation (with our own push system), which triggers call to DataSource.invalidateCache()
    - 2nd user refreshes a grid with a field having this DS set as optionDataSource
    => Change isn't taken into account.

    This problem seems to affect only ListGridFields: performing a refresh on a ListGrid that uses this DS, or displaying a SelectItem with this same DS triggers the following request:
    Code:
    === 2014-06-05 14:39:11,325 [l0-6] DEBUG RPCManager - Request #1 (DSRequest) payload: {
        criteria:{
        },
        operationConfig:{
            dataSource:"businessUnit",
            operationType:"fetch",
            textMatchStyle:"exact"
        },
        componentId:"(cacheAllData fetch)",
        appID:"builtinApplication",
        operation:"loadCache",
        oldValues:null
    }
    When DS is used only as optionDataSource on a ListGridField, refreshing the parent ListGrid doesn't trigger cache reload.

    Issue can be reproduced with all operations (add/update/remove).

    DataSource definition:
    Code:
    <DataSource xmlns:fmt="WEB-INF/"
        ID="businessUnit"
    	serverType="sql"
    	tableName="SEC_BUSINESS_UNIT"
    	serverConstructor="com.fircosoft.cdb.server.administration.BusinessUnitDataSource"
    	audited="true"
    	insertAuditEvent="2701"
    	updateAuditEvent="2702"
    	removeAuditEvent="2703"
    	titleField="NAME"
    	fireEventOnDataChanged="true"
    	cacheAllData="true"
    	cacheAllOperationId="loadCache"
    	cacheAcrossOperationIds="false"
    >
    
    ...
    
        <operationBinding operationType="fetch" operationId="loadCache">
    	        <selectClause>SEC_BUSINESS_UNIT.ID, SEC_BUSINESS_UNIT.NAME</selectClause>
    	        <whereClause>SEC_BUSINESS_UNIT.DELETED = 0 AND SEC_BUSINESS_UNIT.ID > 0</whereClause>
    	    </operationBinding>
        </operationBindings>
    </DataSource>
    Client code that handles data changes notifications:
    Code:
      final String id = ds.getID();
    			
      //Listener for main data source
      EventManager.register(new DataChangedEventListener(id) {
      @Override
      public void notifyDataChanged(DataChangedEvent event) {
    	String dsId = id;
    	if (DataSource.get(dsId) != null && DataSource.get(dsId).getCacheAllData())
    		DataSource.get(dsId).invalidateCache();
            }
    }, DataChangedEvent.class);
    Did I miss something in client-side cache configuration? Or is there a special setup for ListGridField?

    Thanks in advance for your help
    Antoine
Working...
X