Remove all rows from DataGrid

How do I programatically remove all rows from a data grid for it to refresh I am building it like this:

for item in data:  
  row = DataRowPanel(item=item)
  self.sparql_result_table.add_component(row)

This code runs in response to a button click, and needs an empty DataGrid each time the button is clicked.

You could use:

self.data_grid_1.clear() # use the name of your actual DataGrid
4 Likes

Perfect. Thanks :smile: