1

I am trying to create a table having the filter option using any column value in nicegui but unable to do so

I tried to document but It is not very clear to understand that, There are no examples on the internet as well. I am new to nicegui.

1 Answers1

1

I'm not sure if this is what you're looking for. But you can filter the rows of a ui.table like this:

columns = [
    {'name': 'name', 'label': 'Name', 'field': 'name', 'required': True, 'align': 'left'},
    {'name': 'age', 'label': 'Age', 'field': 'age', 'sortable': True},
]
rows = [
    {'name': 'Alice', 'age': 18},
    {'name': 'Bob', 'age': 21},
    {'name': 'Carol'},
]
f = ui.input('Filter')
ui.table(columns=columns, rows=rows, row_key='name').bind_filter_from(f, 'value')
Falko
  • 17,076
  • 13
  • 60
  • 105