I've a table which have property mode="MultiSelect" So i can select multiple items in table. and I've delete button The GUI of Table is as below.
the XML of table is
<Table id="idcorrelationData" mode="MultiSelect" items="{/correlationData}">
<headerToolbar>
<Toolbar>
<Title text="Correlation Data" level="H2"/>
<ToolbarSpacer></ToolbarSpacer>
<Button icon="sap-icon://add" press="onAddNewRow"/>
<Button icon="sap-icon://delete" press="onRemoveLasRow"/></Toolbar>
</headerToolbar>
<columns>
<Column hAlign="Center">
<Text text="Data Location"/>
</Column>
<Column minScreenWidth="Tablet" demandPopin="true" hAlign="Center">
<Text text="Accepted Value"/>
</Column>
</columns>
<items>
<ColumnListItem>
<cells>
<Input enabled="{/fieldEditAble}" value="{dataLocation}"/>
<Input enabled="{/fieldEditAble}" value="{acceptedValue}"/>
</cells>
</ColumnListItem>
</items>
Which is binded with JSON, initially the data comes from database.which have two below properties.
var correlationData = [{
"dataLocation": "",
"acceptedValue": ""
}];
On delete button of table i want to delete selected Rows of table. My Query is How I can delete selected Values ?
sap.m.Table
inherits from sap.m.ListBase
so you can try using the removeSelections()
function. See here for more information: https://sapui5.hana.ondemand.com/explored.html#/entity/sap.m.ListBase/methods
Also if you delete it from the model, as long as the table is binded to it then it will update automatically. You can therefore delete from the model instead.