-
Hello, thanks a lot, for any idea :-) and help. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
hi ! It is tricky to do with Quasar table already, so using it with niceGUI is even more! You can see an example at: Regarding your particular need, What you need is called "body slot' in Quasar element : Here is a minimal example : with ui.table(columns=[
{'name': 'name', 'label': 'Name', 'field': 'name', 'sortable': True, 'align': 'left'},
{'name': 'age', 'label': 'Age', 'field': 'age', 'sortable': True, 'align': 'left'},
{'name': 'actions', 'label': 'Actions', 'field': 'actions', 'align': 'left'},
], rows=[
{'id': 1, 'name': 'Damien', 'age': 18, 'actions': ['edit', 'delete']},
{'id': 2, 'name': 'Janine', 'age': 19, 'actions': ['edit']},
{'id': 3, 'name': 'John', 'age': 20, 'actions': ['edit', 'delete']},
]) as table:
table.add_slot('body', """
<q-tr :props="props">
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<q-btn v-if="col.name === 'actions'" v-for="action in col.value" : key="action"
round dense flat :icon="action" class="mr-2"
:href="'user/' + props.row.id + '/' + action"
/>
<span v-else>{{ col.value }}</span>
</q-td>
</q-tr>
""") You can also add a fully new column that is not passed to |
Beta Was this translation helpful? Give feedback.
hi !
It is tricky to do with Quasar table already, so using it with niceGUI is even more! You can see an example at:
https://github.com/zauberzeug/nicegui/blob/main/examples/table_and_slots/main.py
Regarding your particular need, What you need is called "body slot' in Quasar element :
https://quasar.dev/vue-components/table#body-slots
Here is a minimal example :