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

    Drop missing values


    Is there a recommended way for dropping values that are missing from the bound option data source? For form items, the logic now seems to be that the missing id is shown in the selector. If we have a SelectItem bound to a data source, and the related record has been deleted server-side, the select item will show the numerical primary key of the selection as a value.

    What we would prefer to achieve is that when this happens, the actual value is cleared (or dropped if the value is of multiple type). We have some backends where we cannot control the relationships of the assets. It happens that the related assets (from the option data source) are removed from time to time. When this happens, we are stuck with numerical invalid values at the other end when the users are editing the assets. We have been struggling to implement this without any serious side-effects with no luck.


    See FormItem.fetchMissingValues - a fetch is automatically performed against the optionDataSource to look up the display value.

    You could detect that such a fetch failed by watching the responses with a DataSource responseTransformer and clear out the value in that case (if that's what you want to do about it).


      Thanks. We are using fetchMissingValues and have tried a bit in this route.

      How do we actually detect the value was really missing? We tried to implement a DataArrivedHandler, had to rely on JSNI to access the select item's value map to peek for missing values but never really got this to work reliably.

      If we would do this in transformResponse, is there a way to distinguish which requests are fetches for missing values?

      For us, it would probably be enough also if we could implement a Formatter for display value in a way, which would just skip rendering of these missing values. The hard part for us is to know (in the formatted code) which values actually were missing.


        With a formatter you can just check for getSelectedRecord() being null. In transformResponse(), there are multiple ways to tell, but one would be the componentId and the PK present in the criteria.