我遇到了一些有线问题。
<core:FragmentDefinition xmlns="sap.ui.table" xmlns:dnd="sap.ui.core.dnd" xmlns:mvc="sap.ui.core.mvc" xmlns:core="sap.ui.core"
xmlns:m="sap.m">
<m:Dialog id="AuftragDialog" title="Aufträge">
<!-- <m:beginButton>
<m:Button text="Fertig" press=".onSaveAufträge"/>
</m:beginButton> -->
<m:endButton>
<m:Button text="Zurück" press=".onCancelAufträge"/>
</m:endButton>
<m:content>
<m:HBox renderType="Bare">
<Table id="table1" selectionMode="MultiToggle" rows="{ path: 'Hallo>/results' }" visibleRowCount="10">
<extension>
<m:OverflowToolbar>
<m:Title text="Alle Aufträge"/>
<m:ToolbarSpacer/>
<m:SearchField id="allOrder" liveChange="onFilterAllOrder">
<m:layoutData><m:OverflowToolbarLayoutData minWidth="25%" maxWidth="30%" /></m:layoutData>
</m:SearchField>
</m:OverflowToolbar>
</extension>
<columns>
<Column >
<m:Text text="Auftrags Nummer"/>
<template>
<m:Text text="{Hallo>Aufnr}" wrapping="false"/>
</template>
</Column>
<Column filterProperty="Ktext">
<m:Text text="Auftrag"/>
<template>
<m:Text text="{Hallo>Ktext}" wrapping="false"/>
</template>
</Column>
</columns>
<dragDropConfig>
<dnd:DragInfo groupName="moveToTable2" sourceAggregation="rows" dragStart="onDragStart"/>
<dnd:DropInfo groupName="moveToTable1" drop="onDropTable1"/>
</dragDropConfig>
</Table>
<m:VBox justifyContent="Center" class="sapUiTinyMarginBeginEnd">
<m:Button class="sapUiTinyMarginBottom" icon="sap-icon://navigation-right-arrow" tooltip="Move to selected" press="moveToTable2"/>
<m:Button icon="sap-icon://navigation-left-arrow" tooltip="Move to available" press="moveToTable1"/>
</m:VBox>
<Table id="table2" selectionMode="MultiToggle" rows="{/ZAUFK_VARSet}" visibleRowCount="10" noData="Bitte wählen sie Ihre Aufträge aus.">
<extension>
<m:OverflowToolbar>
<m:Title text="Selektierte Aufträge"/>
<m:ToolbarSpacer/>
<m:SearchField id="selectedOrder" liveChange="onFilterSelectedOrder">
<m:layoutData><m:OverflowToolbarLayoutData minWidth="25%" maxWidth="30%" /></m:layoutData>
</m:SearchField>
</m:OverflowToolbar>
</extension>
<columns>
<Column>
<m:Text text="Auftrags Nummer"/>
<template>
<m:Text text="{Aufnr}" wrapping="false" />
</template>
</Column>
<Column filterProperty="Ktext">
<m:Text text="Auftrag"/>
<template>
<m:Text text="{Ktext}" wrapping="false" />
</template>
</Column>
</columns>
<dragDropConfig>
<dnd:DragInfo groupName="moveToTable1" sourceAggregation="rows" dragStart="onDragStart"/>
<dnd:DropInfo groupName="moveToTable2" targetAggregation="rows" dropPosition="Between" drop="onDropTable2"/>
<dnd:DragDropInfo sourceAggregation="rows" targetAggregation="rows" dropPosition="Between" dragStart="onDragStart" drop="onDropTable2"/>
</dragDropConfig>
</Table>
</m:HBox>
</m:content>
</m:Dialog>
那是我的片段..在table1上有一个Searchfield,它可以正常工作..
在table2的第二个表上,这不起作用。
我真的不知道为什么..一个是json模型,另一个不是..也许那就是为什么?
控制器
onFilterAllOrder: function (oEvent) {
var oTable = this.byId("table1");
var searchText = oEvent.getParameters().newValue;
var filters = [];
if (searchText.trim() != '') {
var filter1 = new sap.ui.model.Filter({
path: "Ktext",
operator: sap.ui.model.FilterOperator.Contains,
value1: searchText
});
filters = [filter1];
var finalFilter = new sap.ui.model.Filter({
filters: filters,
and: false
});
oTable.getBinding("rows").filter(finalFilter, sap.ui.model.FilterType.Application);
} else {
oTable.getBinding("rows").filter([], sap.ui.model.FilterType.Application);
}
},
onFilterSelectedOrder: function (oEvent) {
var oTable = this.byId("table2");
var searchText = oEvent.getParameters().newValue;
var filters = [];
if (searchText.trim() != '') {
var filter1 = new sap.ui.model.Filter({
path: "Ktext",
operator: sap.ui.model.FilterOperator.Contains,
value1: searchText
});
filters = [filter1];
var finalFilter = new sap.ui.model.Filter({
filters: filters,
and: false
});
oTable.getBinding("rows").filter(finalFilter, sap.ui.model.FilterType.Application);
} else {
oTable.getBinding("rows").filter([], sap.ui.model.FilterType.Application);
}
}
所以也许我看不到东西?或犯一些错误?所以我尝试了所有方法..但没有任何效果..我的意思是它应该和以前的一样,但是不起作用...
答案 0 :(得分:1)
如果后者是OData模型,并且您尚未将操作模式设置为客户端,则将针对服务进行过滤。在这种情况下,将向后端发出请求,并且如果该服务确实忽略了$filter
,您将看不到任何更改。
检查“网络”标签,查看是否已发出请求。