Skip to content

Refresh quasar table content similar to table.update()? #577

Closed Answered by falkoschindler
pythonormen asked this question in Q&A
Discussion options

You must be logged in to vote

You can use methods like table.add_rows and table.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 to table.rows. After completing all changes, you should call table.update(). Let me give an example:

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'}…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pythonormen
Comment options

Answer selected by pythonormen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants