我有一个OData模型机> / config和一个json模型runDialog。
我想在一个表中显示machine> / config的全部内容,其中machine ID等于runDialog字段machineID的JSON模型的ID:
<Table id="tableMachineConfig"
items="{path:'machine>/config', filters: [{path: 'machine>id', operator: 'EQ', value1:
'{runDialog>/machineID}'}], sorter: {path: 'machine>type'}}">
我为value1尝试了不同的方法:
value1: '{runDialog>/machineID}'
value1: {runDialog>/machineID}
value1: {path: 'runDialog>/machineID'}
value1: '{path: 'runDialog>/machineID'}'
value1: 'runDialog>/machineID'
似乎没有任何作用。过滤器value1不包含计算机ID,但包含xml中设置的文本的文本表示形式。
无法在xml视图中绑定动态过滤器,但可以在JavaScript代码中进行绑定:
var oTable = sap.ui.getCore().byId("tableMachineConfig");
var oFilters = [new sap.ui.model.Filter("Pa", sap.ui.model.FilterOperator.EQ, pacode),
new sap.ui.model.Filter("PfNum", sap.ui.model.FilterOperator.EQ, pfcode),
new sap.ui.model.Filter("Psa", sap.ui.model.FilterOperator.EQ, psacode)
];
oTable.bindAggregation("items", {
path: 'machine>/config',
filters: oFilters
});