on 2024 Aug 22 3:54 PM
Hello everybody,
I am building an SAPUI5 application based on OData V2 build with SEGW.
I am facing a weird behavior: In a sap.m.Table my created entries are duplicated after submitting and refreshing.
The table is defined like this:
<Table
id="KeyfToSourceTable"
mode="{= ${keyfEdit>/editing} ? 'MultiSelect' : 'None' }"
items="{
path: '/MapKeyfSourceSet'
}" >
<headerToolbar>
<OverflowToolbar>
<Title text="Table" level="H3" />
<ToolbarSpacer />
<Button
icon="sap-icon://add"
press=".onDatasourceHelpRequested"
visible="{keyfEdit>/editing}" />
<Button
icon="sap-icon://delete"
press=".onDatasourceDeletePressed"
visible="{keyfEdit>/editing}" />
</OverflowToolbar>
</headerToolbar>
<columns>
<Column>
<Text text="Sourcestxt" />
</Column>
<Column>
<Text text="Employeetext" />
</Column>
<Column>
<Text text="SbTxtlg" />
</Column>
</columns>
<items>
<ColumnListItem vAlign="Middle">
<cells>
<ObjectIdentifier
title="{Sourcestxt}"/>
<Text
text="{Employeetext}" />
<Text
text="{SbTxtlg}" />
</cells>
</ColumnListItem>
</items>
</Table>It displays entities mapped to my main object. So I filter these at runtime (and sometimes I have to rebind the table):
var sourceSystemTable = this.byId("KeyfToSourceTable");
var keyfId = this.getView().getBindingContext().getProperty("Keyfid");
var filterArray = [new Filter("Keyfid", FilterOperator.EQ, keyfId)];
sourceSystemTable.bindItems({path:"/MapKeyfSourceSet", template: oldTemplate, filters: new Filter(filterArray, true)})The User should be able to edit the main object and the mapping table and just save at the end. But the table should display the new entries, which are not persisted yet. Therefore I use the ODataListBinding.create function like it is discribed in the documentation:
this.byId("KeyfToSourceTable").getBinding("items").create(oEntry, {
inactive : false,
success: function(data) {
alert("success createdMapping");
},
error: function(data) {
alert("error createdMapping");
}
});It works as designed, new Entries are shown and not persisted until the user clicks "save" and submitChanges() is called.
But after a refresh() is called or the Binding of the table is changed, the new entries are duplicated. They are added at the top of the table again. I already looked at the BindingContexts of the items and the binding of the table, the bindings seem absolutly the same.
Even when I look at a differend main object and the filter doesn't seem to work for these duplicates. They also appear at the top of the table. But looking at the binding and also getting the filterted property, they shouldn't be there. These duplicates don't exists in the backend/data base tables. They also all are not transient, so I am not able to filter them by myself.
I assume these duplicates are just in the client model.
I appreciate any help,
Kind regards
Tobias
Request clarification before answering.
| User | Count |
|---|---|
| 7 | |
| 6 | |
| 6 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.