I try to set the selected Sort Item on a ViewSettingsDialog via an JSONModel.
Unfortunately, the desired ViewSettingsItem is not set under the "sortItems" aggregation.
As a cross check, setting "sortDescending" with JSONModel works.
It also works when I enter the key directly. This example is also described here https://openui5.hana.ondemand.com/entity/sap.m.ViewSettingsDialog/sample/sap.m.sample.ViewSettingsDialog/code/DialogPreselected.fragment.xml
Here is the ViewSettingsDialog:
<core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core"> <ViewSettingsDialog id="linkHeaderViewSettingsDialog" confirm="handleConfirm" sortDescending="{settings>/sortOrderDecending}"> <sortItems> <ViewSettingsItem key="downloadsCurrentFortnight" text="downloadsCurrentFortnight"/> <ViewSettingsItem key="downloadsCurrentMonth" text="downloadsCurrentMonth" /> <ViewSettingsItem id="downloads365" key="downloads365" text="downloads365" selected="{= ${settings>/selectKey} === 'downloads365'}" /> <ViewSettingsItem key="vscodeInstalls" text="vscodeInstalls"/> <ViewSettingsItem key="updatedAt" text="updatedAt" /> <ViewSettingsItem key="createdAt" text="createdAt" /> <ViewSettingsItem key="addedToBoUI5" text="addedToBoUI5" /> </sortItems> </ViewSettingsDialog> </core:FragmentDefinition>
I created a minimum example here: https://github.com/marianfoo/ui5-viewsettingsdialog-sort/tree/main/uimodule/webapp
I deployed this on GitHub Pages here: https://marianfoo.github.io/ui5-viewsettingsdialog-sort/
I also tried to set the "selected" property on "ViewSettingsItem" via JSONModel. That didnt work either.
I can of course set the settings in the controller to the JSONModel, but I would like to avoid that.
Latest OpenUI5 Version 1.103.0 is used here.
Can someone please help me here or nudge me in the right direction.