Skip to Content
0
Aug 12, 2020 at 07:55 PM

SAPUI5: Value Help Dialog XML Fragment not rendering correct data but duplicating same row

286 Views Last edit Aug 13, 2020 at 04:32 AM 3 rev

Hello All,

I have a Value Help Dialog XML Fragment that has a <StandardListItem> control. The title and description properties are bound to an oData EntitySet which has 3 properties but only two are bound, the key and text. The issue I am facing is that the data doesn't show correctly, it repeats one record for the amount of times the EntitySet has data related to the key in question. For example, EntitySet('KEY') may have 14 records associated to it, but instead of showing 14 unique values in the UI control it repeats one value 14 times. Then EntitySet('KEY2') might have 29 associated values but it will repeat one row 29 times...etc.

The code for the fragment is:

<core:FragmentDefinition xmlns="sap.m">
    <SelectDialog
        id="id"
        title="title" 
        class="sapUiPopupWithPadding"
        items="{/EntitySet}"
        search="_onValueHelpSearch"
        confirm="_onValueHelpConfirmPress" 
        cancel="_onValueHelpConfirmPress">
        <StandardListItem
            title="{key}"
            description="{text}"/>
    </SelectDialog>
</core:FragmentDefinition>

Then in the app.view.xml I have the Input field which has the value help to this fragment like so:

<Input 
   id="id" 
   showValueHelp="true" 
   valueHelpOnly="true" 
   valueHelpRequest=".onValueHelp"
   suggestionItems="{ 
      path: '/EntitySet', 
      sorter: { path: 'key' } 
   }"  
   >
      <core:Item key="{key}" text="{text}"/>
   </Input>   

Then finally in the controller, I create the ValueHelpDialog in the onValueHelp function like so:

onValueHelp: function (oEvent) {
   this._oValueHelpDialog = sap.ui.xmlfragment("com.myco.vhd", this);
   this.getView().addDependent(this._oValueHelpDialog);
   this._oValueHelpDialog.open();
}

Any help, tips, suggestions and ideas are all welcome! Thanks experts.

PS.