Hi Experts,
I am having a sap.m.table. Here I binds an json model. Also I am having option to delete and insert rows.
While deleting I can able to delete the selected item successfully with below code.
var oTable = this.getView().byId("XXX");
var selItem = oTable.getSelectedItem();
oTable.removeItem(selItem);
Again If I insert any data to the table I am getting error as "2015-06-30 12:23:39 adding element with duplicate id '__text9-__xmlview2--XXX-2'" -
My insert code as
var bindingContext = this.getView().getBindingContext().getPath();
var oModel = this.getView().getModel();
var laborObject = oModel.getProperty(bindingContext+"/labourActivity");
laborObject.push(entry); //entry is the object of exact values
oModel.setProperty(bindingContext+"/labourActivity",laborObject,null,true);
oModel.updateBindings(true);
oModel.refresh(true);
This code is not working in combination of delete and insert. Its working fine only for the insert. If i delete and insert again. its dumps again.
My table code as
<Table id="XXX" inset="true" showOverlay="false" class="swoPadding" mode="SingleSelectMaster" items="{labourActivity}">
<columns>
<Column>
<Text text="FSE Name"/>
</Column>
<Column minScreenWidth="Tablet" demandPopin="true">
<Text text="Activity"/>
</Column>
<Column minScreenWidth="Tablet" demandPopin="true">
<Text text="Date"/>
</Column>
<Column minScreenWidth="Tablet" demandPopin="true">
<Text text="Start"/>
</Column>
<Column minScreenWidth="Tablet" demandPopin="true">
<Text text="End"/>
</Column>
<Column>
<Text text="Duration"/>
</Column>
<Column>
<Text text="Operation"/>
</Column>
</columns>
<items>
<ColumnListItem>
<cells>
<Text text="{fscName}"/>
<Text text="{activity}"/>
<Text text="{date}"/>
<Text text="{start}"/>
<Text text="{end}"/>
<Text text="{duration}"/>
<Text text="{operation}"/>
</cells>
</ColumnListItem>
</items>
</Table>
Thanks & Regards
Rabin D