I need to provide a mechanism to reset the settings facet on list views. That is, to reset the selected columns, column order, column widths, etc. to the defaults defined in the view.
I’ve created a button on the view that deletes the view key from UserSettingsCache. However, the user must switch to another view and come back before they see the default settings of the view.
Is there a way to reset the settings and see the change immediately without switching views? Below is my button code. Perhaps there is a better solution:
@Autowired
private UserSettingsCache userSettingsCache;
@Subscribe(id = "clearSettings", subject = "clickListener")
protected void onClearSettingsClick(final ClickEvent<JmixButton> event) {
var viewId = UiComponentUtils.getCurrentView().getId();
if(viewId.isPresent()) {
userSettingsCache.delete(viewId.get());
}
}
Thanks!