Datatable remove row (#2253)

* Checking in remove_row progress

* Ensuring structures updated correctly when row deleted

* Clamping index

* Failed attempt

* Removing rows

* Update a type hint in DataTable

* Remove some code that wasnt required

* Use index syntax instead of get

* Add DataTable remove row test

* Snapshot tests for removing rows

* Add a docstring for DataTable.remove_row method

* Update changelog regarding DataTable.remove_row

* Add check_idle call to remove_row
This commit is contained in:
darrenburns
2023-04-11 18:48:58 +01:00
committed by GitHub
parent 13939499d9
commit 6352ceb61b
7 changed files with 273 additions and 2 deletions

View File

@@ -289,6 +289,19 @@ async def test_add_columns_user_defined_keys():
assert key == key
async def test_remove_row():
app = DataTableApp()
async with app.run_test():
table = app.query_one(DataTable)
table.add_columns("A", "B")
for row in ROWS:
table.add_row(row, key=row[0])
assert len(table.rows) == 3
table.remove_row(ROWS[0][0])
assert len(table.rows) == 2
async def test_clear():
app = DataTableApp()
async with app.run_test():