Search code examples
javascriptsapui5

Handle behavior of CONFIRM event for SelectDialogBox


I have a list of records. To display the list, I am using sap.m.SelectDialog:

<SelectDialog id="idSelDgAddSupervisor" confirm="handleConfirm" growingThreshold="2000" growing="true" showClearButton="true"
        items="{items}" multiSelect="true"
        liveChange="handleSearch" title="{i18n>Choose}"
         autoAdjustWidth="true" growingScrollToLoad="true">
        <StandardListItem id="idItem" description="{Name}"
            iconDensityAware="false" iconInset="false"
            title="{Plant}" type="Active"/>
    </SelectDialog>

enter image description here

On top of this, I have put a "warning" message box in handleConfirm() function, if user selects more than one entry. Something like this:

enter image description here

WHAT IS HAPPENING RIGHT NOW When user selects more that one entry, it shows the warning message, BUT it closes the selection popover before it shows popover.

WHAT I WANT TO ACHIEVE When user clicks on "OK" button in warning message, it should go back to entry selection screen, and selection popover should not close until user selects ONLY one entry.

Is it possible? Thanks in advance.


Solution

  • I found a solution for this. What I did was, in onClose event of dialog, I destroyed the id of dialog, and reopened the same dialog after destroying the id (so as to save my code from generating "duplicated element id" error).