QTable with Selection has no checkboxes #736
-
|
Hi, from trame.app import get_server
from trame.ui.quasar import QLayout
from trame.widgets import quasar, html
server = get_server()
server.client_type = "vue3"
state, ctrl = server.state, server.controller
COLUMNS = [
{"name": 'name', "label": 'Dessert (100g serving)', "field": "name"},
{"name": 'calories', "align": 'center', "label": 'Calories', "field": 'calories'},
{"name": 'fat', "label": 'Fat (g)', "field": 'fat'}
]
ROWS = [{"name": 'Frozen Yogurt', "calories": 159, "fat": 6.0},
{"name": 'Ice cream sandwich', "calories": 237, "fat": 9.0},
{"name": 'Eclair', "calories": 262, "fat": 16.0},
{"name": 'Cupcake', "calories": 305, "fat": 3.7},
{"name": 'Gingerbread', "calories": 356, "fat": 16.0},
{"name": 'Jelly bean', "calories": 375, "fat": 0.0},
{"name": 'Lollipop', "calories": 392, "fat": 0.2},
{"name": 'Honeycomb', "calories": 408, "fat": 3.2},
{"name": 'Donut', "calories": 452, "fat": 25.0},
{"name": 'KitKat', "calories": 518, "fat": 26.0}]
state.table = {
"flat": True,
"bordered": True,
"title": "Treats",
"rows": ("table_rows", ROWS),
"columns": ("table_headers", COLUMNS),
"row_key": "name",
"selection": "multiple",
"v_model_selected": ("selection", []),
"filter": ("query", "")
}
with QLayout(server):
with quasar.QPageContainer():
with quasar.QPage():
with quasar.QInput(v_model="query", filled=True, type="search", hint="Search"):
with html.Template(v_slot_append=True):
quasar.QIcon(name="search")
print(quasar.QTable(**state.table))
if __name__ == "__main__":
server.start()Unfortunately my resulting Website does not contain any checkboxes to select the rows. The example layout.py on the Trame-Quasar-Project does yet not contain an example for a table (https://github.com/Kitware/trame-quasar/blob/master/example/layout.py). In the trame-docs the "v_model_selected"-prop does not follow the convention but changing it to just "selected" still does not work (https://trame.readthedocs.io/en/latest/trame.widgets.quasar.html#trame.widgets.quasar.QTable). Can anyone help me recreating it please? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
Try to print your layout and if that does not match the Quasar doc, add missing property by registering them with the |
Beta Was this translation helpful? Give feedback.
That works for me