在 table 中使用动态值 1 进行过滤
Filter with dynamic Value1 in table
我有一个 OData 模型 machine>/config 和一个 json 模型 runDialog。
我想在 table 中显示 machine>/config 的全部内容,其中机器 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'
似乎什么都没有 work.Filter 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
});
我有一个 OData 模型 machine>/config 和一个 json 模型 runDialog。
我想在 table 中显示 machine>/config 的全部内容,其中机器 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'
似乎什么都没有 work.Filter 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
});