cancel
Showing results for 
Search instead for 
Did you mean: 

View Extension Data from two different Odata collections

0 Kudos
Dear Experts, I am currently extending a standard Fiori App.

My view View1's Object attribute is currently binded with "test_srv/testlist1/personal number". In the same view (View1) I have added another Object attribute and that should be binded with "test_srv/testlist2/personal number". could some one provide a snippet to bind the elements from a different collections in the same view? Many thanks for your response.


Thanks

Accepted Solutions (1)

Accepted Solutions (1)

former_member185414
Active Contributor

I have lost touch with UI5 development but I can suggest you to try this.

1. On the onInit function of controller, create and load two named json models. Example-

//model for storing approvers for the request

this._oApproverModel = new JSONModel({ Approvers: [] });

// Set the named model

this.getView().setModel(this._oApproverModel, "approverModel");

//model for print options for the request

this._oPrintModel = new JSONModel({ PrintOptions: [] });

// Set another named model

this.getView().setModel(this._oPrintModel, "printModel");

2. Instead of single view, I did similar thing(binding two named json models) on multiple fragments instantiated from same view.

(It's difficult to provide this code as it is split across multiple Utility functions)

3. Fragment binding code -

<core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core"> <Popover showHeader="false" placement="Auto"> <content> <List items="{approverModel>/Approvers}"> <items> <ObjectListItem title="{= ${approverModel>ApproverName} + ' (' + Math.round(${approverModel>ApproverId}) + ')'}" > </ObjectListItem> </items> </List> </content> </Popover> </core:FragmentDefinition>

BR.

Answers (0)