I have a table that is filled when the user inputs some data, I want to make a reset button so the table can be cleared completely.
Is there a way to do this without coding functions from scratch? (like clearLayers() for clearing a leaflet map for example)
Thanks. Edit: added code example
//this array is dynamically inputted & can have as many rows as user wants
arrayNum = [
{1, chair, test, blue, sky, 1000}
{2, hair, test, orange, stars, 100}
{3, bair, test, yellow, moon, 10000}
{4, care, test, red, sun, 86399}
]
addToTable(res) {
rows.push (
<TableRow>
<TableCell> {res} </TableCell>
</TableRow>
}
//inside handleClick
for ( var i = 0; i<arrayNum.length; i++)
{
//some more code
addToTable(arrayNum(i));
}
//button using handleClick onClick
<Table>
<TableHead>
//static header values
</TableHead>
<TableBody>
{rows}
</TableBody
</Table>