Refresh quasar table content similar to table.update()? #577
-
I'm trying to convert from aggrid to quasar, but can't figure out how to refresh/update the content. For the aggrid element I use this every time I have to update the data: table.options['rowData'] = sorted(table_data, key=lambda data: data['scheduled'])
table.update() But I can't figure out how to manage refresh on Quasar? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You can use methods like Alternatively you can directly modify columns = [
{'name': 'name', 'label': 'Name', 'field': 'name'},
{'name': 'age', 'label': 'Age', 'field': 'age'},
]
rows = [
{'name': 'Alice', 'age': 18},
{'name': 'Bob', 'age': 21},
{'name': 'Carol'},
]
table = ui.table(columns=columns, rows=rows)
def update_rows():
table.rows[:] = [
{'name': 'Diana', 'age': 19},
{'name': 'Eve', 'age': 22},
{'name': 'Fiona'},
]
table.update()
ui.button('Update rows', on_click=update_rows) Note that |
Beta Was this translation helpful? Give feedback.
You can use methods like
table.add_rows
andtable.remove_rows
.Alternatively you can directly modify
table.rows
. But make sure not to change the reference, i.e. don't assign a new object totable.rows
. After completing all changes, you should calltable.update()
. Let me give an example: