1
是否可以在Aggregation類型綁定中使用表達式綁定。我有一個表,表中的每一行都有一個有sap.m.Select控件的列。我想根據行的屬性將每行中的選擇控件與不同的項綁定在一起。SAPUI5 - Aggregation綁定中的表達式綁定類型
下面是我的樣品例如:
<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>
我的數據模型看起來如下:
{
"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"
}
]
}
}
謝謝schnoedel。由於行數有限,所以使用上面的工廠函數選項。 – Deepak