cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 Select control inside Table with the same items path as the Table

07-30-2019 3:03 PM
1645 views 1 comments Go to solution
0 Likes
SAP Managed Tags
Subscribe

I have the following scenario:

<Table
    id="priceListsTable"
    items="{path : 'myModel>/PriceLists', templateShareable : false}">
    <columns>
        <Column>
            <Text text="Name"/>
        </Column>
        <Column>
            <Text text="Base Price List"/>
        </Column>

    </columns>
    <ColumnListItem>
        <Text text="{myModel>NAME}"/>

        <Select
            id="basePriceList"
            items="{myModel2>/PriceLists}"
            selectedKey="{path:'myModel>BASE_PRICE_LIST_ID', type:'sap.ui.model.odata.type.String'}">
            <core:ListItem key="{myModel2>ID}" text="{myModel2>NAME}"/>
        </Select>

    </ColumnListItem>
</Table>

I'm displaying a price list collection, and every price list has a base price list linked to itself with conversion factor. So, 'items' path of priceListsTable is the same as 'items' path of basePriceList . Is there a way to loop all price lists in basePriceList using myModel and not defining myModel2.

Right now i'm doing it like this in onInit():

this.getView().setModel(this.getOwnerComponent().getModel("myModel"),"myModel2");

Actually, duplicating the model just to use it for Select.

I appreciate any help.

Best regards,
Ebu

0 Likes

Accepted Solutions (1)

Accepted Solutions (1)

junwu
SAP Champion
SAP Champion

I think you are fine. you are not duplicating the model, you just have two alias name.

Answers (0)