Announcement

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

    ComboBoxItem: Is it possible to "turn off cache data"?

    Hi Isomorphic,

    is it possible to fetch the data again every time when dropdown is opened in ComboBoxItem?
    I've tried already with "invalidateDisplayValueCache()", "setCachePickListResults()"... (with everything that could help),
    but it doesn't seem to work.

    In my case: When a user deletes a record from the ListGrid, that record should be displayed in ComboBoxItem, if user opens it.


    Best regards
    Pavo
    Last edited by pavo123; 23 May 2018, 06:05.

    #2
    Did you mean to say that when a record is deleted, it should not appear in the ComboBoxItem?

    If so, this should already be the case due to automatic cache updates. If it doesn't seem to be removed as expected, you can watch the "ResultSet" log category to see what's going on.

    In other situations you can use a call to fetchData() to force new data to be fetched.

    Comment


      #3
      Hi Isomorphic,

      thank you for your help.

      Each user can only have one value e.g."customerColor".
      ListGrid contains customers with "customerColor". Above ListGrid is DynamicForm that contains ComboBoxItem. ComboBoxItem shows customers without "customerColor".
      So when a user deletes a record from ListGrid, that customer doesn't have "customerColor" any more and ComboBoxItem need to fetch data again to displays that "removed record" in dropdown.

      I've solved this problem by calling fetchData() in RemoveRecordClickHandler().

      I already had similar problems and I think it would help me a lot to have a command that would force fetchData() every time when user opens dropdown.


      Best regards
      Pavo

      Comment


        #4
        Hi Isomorphic,

        I had a similar problem several times and I always think how it would be great to have command that would force fetchData() every time when user opens dropdown.
        Last example, briefly: Some properties for each user are loaded only on login (e.g. user roles), so when I change user role I need to fetch new data for ComboBoxItem, but old ones are cached. So I need to logout and log in. Very annoying.

        Best regards
        Pavo
        Last edited by pavo123; 6 Nov 2018, 08:17.

        Comment


          #5
          As we covered for the original poster, a deleted record is automatically removed from cache by the cache synchronization system - he shouldn't have to do anything to his comboBox, but rather fix a problem that needs fixing anyway, for other components.

          As far as other circumstances where the cache becomes invalid, as previously discussed, you can call fetchData().

          While it sounds superficially like a good idea, we don't want to put an option in to always fetch from the server as it's unclear how often would be desirable. For example, the dropdown may open and close multiple times during a single logical interaction with a comboBox, resulting in many unnecessary fetches. Alternatively, not dropping cache frequently enough could result in undesired staleness.

          Since there's no clearly correct way to automatically drop cache, and since putting in an option to drop cache may encourage developers to ignore real problems while also creating performance issues, and since application code already has the ability to drop the cache precisely when it's needed, we don't see think a new setting here is a good idea.

          Comment


            #6
            Further note: use DataSource.invalidateCache() to invalidate all caches on all components that use a given DataSource. That's an easy way to flush cache as needed on role switch (so once again - there's a better approach).

            Comment


              #7
              Hi Isomorphic,

              thank you for a detailed explanation and tip!

              Best regards
              Pavo

              Comment

              Working...
              X