Skip to Content
0
Jul 30, 2019 at 01:03 PM

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

313 Views

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