JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE HTML>
<script src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js"
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.ui.commons,sap.ui.table"
data-sap-ui-theme="sap_bluecrystal">
</script>
<!-- add sap.ui.table,sap.ui.ux3 and/or other libraries to 'data-sap-ui-libs' if required -->
<script>
sap.ui.localResources("tableclear");
var view = sap.ui.view({id:"idsample1", viewName:"tableclear.sample", type:sap.ui.core.mvc.ViewType.JS});
view.placeAt("content");
</script>
</head>
<body class="sapUiBody" role="application">
<div id="content"></div>
</body>
</html>
JavaScript
var aData = [
{lastName: "Dente" ,name: "asd",},
{lastName: "Friese",name: "asd", },
{lastName: "Mann",name: "asd", },
{lastName: "Schutt",name: "asd", },
{lastName: "Open",name: "asd", },
];
var oTable = new sap.ui.table.Table({
title: "Table Example",
visibleRowCount: 7,
firstVisibleRow: 3,
selectionMode: sap.ui.table.SelectionMode.Single,
});
//Define the columns and the control templates to be used
oTable.addColumn( new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "Last Name"}),
template: new sap.ui.commons.TextView().bindProperty("text", "lastName"),
}));
oTable.addColumn(new sap.ui.table.Column({
label: new sap.ui.commons.Label({text: "Checked"}),
template: new sap.ui.commons.CheckBox().bindProperty("checked", "checked"),
}));
//Create a model and bind the table rows to this model
var oModel = new sap.ui.model.json.JSONModel();
oModel.setData(aData);
oTable.setModel(oModel);
oTable.bindRows("/");
var button = new sap.ui.commons.Button("bid",{
text : "refresh",
press : function()
{
var newdata = oModel.getData();
console.log(newdata)
for(var i =0;i<newdata.length;i++)
{
newdata[i].lastName ="",
newdata[i].name = ""
}
oModel.setData(newdata);
oModel.refresh()
}
});
button.placeAt("content");
oTable.placeAt("content")