Reputation: 493
Is it possible to use expression binding in Aggregation type binding. I have a table and each row in the table has a column that has a sap.m.Select control. I want to bind the select control in each row with different items based on a property of the row.
Below is my sample example:
<Table headerText="Dimensions/Measures" mode="MultiSelect" includeItemInSelection="true" items="{path: 'dataModel>/Fields'}">
<columns>
<Column hAlign="Center" vAlign="Center" visible="true">
<header>
<Label text="Dimensions/Measures" />
</header>
</Column>
<Column hAlign="Center" vAlign="Center" visible="true">
<header>
<Label text="Type" />
</header>
</Column>
<Column hAlign="Center" vAlign="Center" visible="true">
<header>
<Label text="Role" />
</header>
</Column>
</columns>
<ColumnListItem>
<Text text="{dataModel>Fieldname}" />
<Text text="{= ${dataModel>Aggr_Oper} !== null ? 'Measure' : 'Dimension'}" />
<Select items="{= ${path: 'dataModel>Aggr_Oper'} !== null ? ${dataModel>/chartConfigData/dimData}: ${dataModel>/chartConfigData/measData}}">
<core:Item key="{dataModel>key}" text="{dataModel>text}" />
</Select>
</ColumnListItem>
</Table>
My Data Model looks as below:
{
"Fields":[
{
"AppID":"RP_PROP",
"AppVariantID":"PropListVariantDemo",
"Fieldname":"PropertyID",
"FieldDescription":"PropertyID",
"Aggr_Oper":null,
"Filterable":null,
"Visible":"true",
"Filter_Val":null,
"DisplayOrder":1,
"FieldGroup":null,
"SubTotal":null,
"FieldType":null,
"Sortable":"true",
"Sort_Op":"ASC",
"Sort_Order":1,
"ChartRole":null,
"BusinessEntity":"BRS"
},
{
"AppID":"RP_PROP",
"AppVariantID":"PropListVariantDemo",
"Fieldname":"Description",
"FieldDescription":"Description",
"Aggr_Oper":null,
"Filterable":null,
"Visible":"true",
"Filter_Val":null,
"DisplayOrder":2,
"FieldGroup":null,
"SubTotal":null,
"FieldType":null,
"Sortable":"true",
"Sort_Op":null,
"Sort_Order":null,
"ChartRole":null,
"BusinessEntity":"BRS"
},
{
"AppID":"RP_PROP",
"AppVariantID":"PropListVariantDemo",
"Fieldname":"PropertyTypeID",
"FieldDescription":"PropertyTypeID",
"Aggr_Oper":null,
"Filterable":null,
"Visible":"true",
"Filter_Val":null,
"DisplayOrder":3,
"FieldGroup":null,
"SubTotal":null,
"FieldType":null,
"Sortable":"true",
"Sort_Op":null,
"Sort_Order":null,
"ChartRole":null,
"BusinessEntity":"BRS"
},
{
"AppID":"RP_PROP",
"AppVariantID":"PropListVariantDemo",
"Fieldname":"PropertyType",
"FieldDescription":"PropertyType",
"Aggr_Oper":null,
"Filterable":null,
"Visible":"true",
"Filter_Val":null,
"DisplayOrder":4,
"FieldGroup":null,
"SubTotal":null,
"FieldType":null,
"Sortable":null,
"Sort_Op":null,
"Sort_Order":null,
"ChartRole":null,
"BusinessEntity":"BRS"
},
{
"AppID":"RP_PROP",
"AppVariantID":"PropListVariantDemo",
"Fieldname":"RegionID",
"FieldDescription":"RegionID",
"Aggr_Oper":null,
"Filterable":null,
"Visible":"true",
"Filter_Val":null,
"DisplayOrder":5,
"FieldGroup":null,
"SubTotal":null,
"FieldType":null,
"Sortable":null,
"Sort_Op":null,
"Sort_Order":null,
"ChartRole":null,
"BusinessEntity":"BRS"
},
{
"AppID":"RP_PROP",
"AppVariantID":"PropListVariantDemo",
"Fieldname":"RegionDescription",
"FieldDescription":"RegionDescription",
"Aggr_Oper":null,
"Filterable":null,
"Visible":"true",
"Filter_Val":null,
"DisplayOrder":6,
"FieldGroup":null,
"SubTotal":null,
"FieldType":null,
"Sortable":null,
"Sort_Op":null,
"Sort_Order":null,
"ChartRole":null,
"BusinessEntity":"BRS"
}
],
"chartConfigData":{
"dimData":[
{
"key":"val1",
"text":"val1"
},
{
"key":"val2",
"text":"val2"
}
],
"measData":[
{
"key":"val3",
"text":"val3"
},
{
"key":"val4",
"text":"val4"
}
]
}
}
Upvotes: 1
Views: 2074
Reputation: 3948
No, dynamic binding paths are not possible. There are some possible workarounds however:
You can process your model data and add a reference to the appropriate select items list to each row. Use a relative binding path to that reference in your select fields binding.
You can use a factory function to create the rows of your table. You can put your row template as dependant to your table and clone it and configure the selects binding for each row in the factory function
You can add multiple selects with different bindings to your table and hide all but one in each row by binding the visible properties of the selects.
Upvotes: 4