cancel
Showing results for 
Search instead for 
Did you mean: 

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

paskal_singh
Explorer

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.

Accepted Solutions (1)

Accepted Solutions (1)

prashil
Advisor
Advisor

Hi Paskal,

Such issues usually occur, if the keys for the entitys are not unique. As oData is subset of rest service, it is mandatory that each key for the item in your entity should have unique URI.

Thanks

Prashil

paskal_singh
Explorer
0 Kudos

Hello Prashil,

Thanks very much, issue is resolved by creating two keys in the oData service.


PS

Answers (0)