Question on dataArrived in version 6.5.1

Hi,
We are using databound select items (using picklist optiondatasource ) in listgrids.
We had a requirement like
whenever the data (options) is fetched from the server for the select item, we will perform some checks on the data and we will make a particular row SELECTED by default for the select item.

     We had implemeted this using dataArrived. But when we were using Smartclinet version 6.0 the dataArrived method (for select item) has been called for the select item whenever there is a startEditingNew() in ListGrid. Things were working fine.

Now we have upgraded the SmartClient version to 6.5.1

Here comes the proplem.
The dataArrived( for select item) method is not being called everytime ( whenever we call startEditing New() in ListGrid.
It seems the select item is using a previously fetched data( from cache) and it doesn’t call the fetch mehod everytime. ( This feature is good overral but it is not helpful for our particular case).

In that case how to clear this data catche for the select item. So that we can make sure the dataArrived is called everytime.

Thanks in advance

Did you notice the new defaultToFirstOption property? Maybe this removes the need for your override.

If not, the dataset will only be re-used if the criteria are identical. You could override getPickListFilterCriteria() to provide differing criteria for each row, and really, the criteria ought to be different if the returned results are different, otherwise you might discover further situations where you are fooling SmartClient into caching data that isn’t cacheable.

Yes. We noticed the defaultToFirstOption already. But in our case this will not work.

Here the criteria is also the same.
( We need to force the select component to fetch the options on every time we call startEditingNew(). This is to reflect the add/remove of the option records by other clients )

Previously we have written a code in dataArrived method and dataArrived is called everytime,everything was fine.
Now due to this cache,things have been changed.

Could you tell us a way to clear this cache.

As a clarification, changing the criteria will cause the cache to be discarded. So this is how you drop the cache.

If you’re going to return a different result from the server, then clearly the criteria really are somehow different (somehow the server knows to return different data, right?). It is because you are “hiding” the true criteria from SmartClient (passing them in some other way, I assume) that you get inappropriate caching.

Hi,
We have a scenerio where we don’t want to change the criteria. But we need to fetch the options from server to get the updated records from db ( whenever we call startEditingNew())

Let me explain a bit clean with an example.

  Consider we have an EmployeeDetails ListGrid in which 'CountryName' is a databound select  component. Intially there are 10 records in 'Country' table.
 
 Clinet #1 ( browser #1 ) has opened the EmployeeDetails screen and created a Employee record ( by calling startEditingNew()). Now the intial 10 countries are listed in countryName combo.

By this time Client #2 ( browser #2) has created few entries in Country table and removed some entries.

Now if the Client 1 tries to add Employee a record ( calling startEditingNew())still there are 10 entries are available in CountryName combo ( previously fetched ). Since the options were already fetched it doesn’t fetch the data again.

Here the criteria is not different, but we need to fetch it ( and load the options while calling startEditingNew()) again to get the updated records.

In the prior versions of the SmartClient we didn’t have this propblem. But due to the cache logic in 6.5.1 we have this problem.

We need a way to clear this optiondatasource cache other than changing the criteria.

Hope you understand our problem.

Thanks.

So, once again, to avoid caching, change the criteria :slight_smile: If what you want is that the request is always issued no matter what, add a constantly varying timestamp as part of the criteria (new Date().getTime()).

Since you’re just trying to pick up other user’s changes on the backend, probably the best approach is a timestamp that changes only every few seconds (eg Math.round(new Date().getTime() / 5000)).