Announcement

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

    Caching problem with ComboBoxItem and OptionDataSource

    We are using Smart GWT 2.5 (power edition) and are facing an issue with a ComboBoxItem.

    The ComboBoxItem is bound to a DataSource and is placed within a Window widget. The problem is that the data for the PickList is not always re-fetched: If a user logs out from the application (which destroys the Window with the ComboBoxItem) and another user logs in (creating a new Window), there is no re-fetch. Instead the ComboBoxItem's pick list shows the old values. So, although autoFetchData is set to false, there is not always a fetch operation performed, when the pick list is first opened.


    ComboBoxItem configuration:
    Code:
    logSymId = new StyledComboBoxItem(Consts.F_LOG_SYM_ID);
    logSymId.setTitle("System");
    logSymId.setOptionDataSource(DataSource
    		.get(Consts.DS_AM_LOGIN_CREATE_SYSTEM));
    logSymId.setValueField(Consts.F_SYM_ID);
    logSymId.setDisplayField(Consts.F_SYM_NAME);
    logSymId.setSortField(Consts.F_SYM_NAME);
    logSymId.setSelectOnFocus(true);
    logSymId.setAutoFetchData(false);
    logSymId.setTextMatchStyle(TextMatchStyle.STARTS_WITH);
    logSymId.setRequired(true);
    logSymId.setAddUnknownValues(false);
    logSymId.setWidth(255);
    logSymId.addChangedHandler(new ChangedHandler() {
    	@Override
    	public void onChanged(ChangedEvent event) {
    		onChangedLogSymId();
    	}
    });
    DataSource definition
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <DataSource ID="am_login_create_system" serverType="sql" tableName="sdm$vi_web_system" cacheAllData="false">
    	<fields>
    		<field name="sym_id" type="integer" required="true" primaryKey="true" />
    		<field name="sym_name" type="text" required="true" length="200" />
    		<fiele name="sym_sty_id" type="integer" required="true" />
    	</fields>
    	<serverObject lookupStyle="new"
    		className="de.tmobile.sdom.frontend.server.dmi.ReadOnlyBaseDMI" />
    	<operationBindings>
    		<operationBinding operationType="fetch">
    			<tableClause>sdm$vi_web_system inner join
    				(select distinct lot_sym_id, ltp_lpt_id from sdm$vi_web_curuser_log_type_pr inner join sdm$vi_web_login_type on ltp_lot_id=lot_id) on
    				sym_id = lot_sym_id</tableClause>
    			<whereClause>ltp_lpt_id = 1 and ($defaultWhereClause)
    			</whereClause>
    		</operationBinding>
    	</operationBindings>
    </DataSource>

    DSRequest (is not always performed)
    Code:
    {
        "dataSource":"am_login_create_system", 
        "operationType":"fetch", 
        "data":null, 
        "resultSet":[ResultSet ID:isc_ResultSet_7 (created by: undefined)], 
        "callback":{
            "caller":[ResultSet ID:isc_ResultSet_7 (created by: undefined)], 
            "methodName":"fetchRemoteDataReply"
        }, 
        "willHandleError":true, 
        "showPrompt":true, 
        "oldValues":null, 
        "clientContext":{
            "requestIndex":1
        }, 
        "requestId":"am_login_create_system$62719"
    }

    #2
    This information obviously isn't enough to reproduce the problem - whatever is going on is related to how you're destroying and re-creating the Window and ComboBoxItem. Let us know if you can product a minimal test case that suggests that there may be a bug in SmartGWT.

    Comment


      #3
      Hi,

      thank you for your help. We have found a workaround that seems to solve the issue.
      Obviously, some kind of caching problem occurred. Therefore, we added a dummy criteria to the request that contains the current system time. Now, the fetch operation is always performed when the ComboBoxItem is created.

      Code:
      logSymId.setOptionCriteria(CriteriaHelper.createFetchAlwaysCriteria());
      logSymId.setAutoFetchData(true);
      Code:
      public static Criteria createFetchAlwaysCriteria() {
      		Criteria c = new Criteria();
      		c.addCriteria(Consts.F_PROVOKE_FETCH, "" + System.currentTimeMillis());
      		return c;
      	}

      Comment

      Working...
      X