Skip to content

Creating Tables with buttons, that perfom actions based on their row #815

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

You must be logged in to vote

Hi @miqsoft! You can use a button that emits a custom event on the table:

with ui.table(columns, rows=data).classes('w-full bordered') as table:
    table.add_slot(f'body-cell-value', """
        <q-td :props="props">
            <q-btn @click="$parent.$emit('action', props)" icon="send" flat />
        </q-td>
    """)
    table.on('action', lambda msg: print(msg))

The received event message contains plenty of information about the current row.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@akai-1024
Comment options

Answer selected by falkoschindler
Comment options

You must be logged in to vote
2 replies
@falkoschindler
Comment options

@hurdlea
Comment options

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