Page 1 of 1

[VUE 3] CellMenuItem Event - get clicked menu item

Posted: Thu Jun 23, 2022 3:08 pm
by info@sundair.com

Hi,

We are trying to catch the clicked cellMenuItem with the listener cellMenuItem.

This is our config file

// ...
cellMenuFeature: {
        items: {
            removeRow: false,
            cut: false,
            copy: false,
            editInvoice: {
                text: 'Edit Invoice',
                icon: 'lnir lnir-pencil',
                weight: 200,
            },
            showInvoiceVoucher: {
                text: 'Show Invoice Voucher',
                icon: 'lnir lnir-tag',
                weight: 200,
            },
            showInvoiceHistory: {
                text: 'Show Invoice History',
                icon: 'lnir lnir-menu-alt-4',
                weight: 200,
            },
// ...

and this is our vue component

<VCard class="mb-6 px-0 py-0">
            <bryntum-grid
                id="grid-invoices"
                ref="gridInvoicesRef"
                v-bind="gridInvoicesConfig"
                :row-height="rowHeight"
                :data="invoices"
                @cellMenuItem="(x: any) => test(x)" />
    </VCard>

And now we want to know on which of the cell menu items the user has clicked. Can we recieve this info, when listening to cellMenuItem?

We know that the event object looks like this: https://www.bryntum.com/docs/grid/api/Grid/feature/CellMenu#event-cellMenuItem but after scanning this object multiple times and the docu we do not know how to get this info.

Thank you :)


Re: [VUE 3] CellMenuItem Event - get clicked menu item

Posted: Thu Jun 23, 2022 3:44 pm
by marcio

Hey,

To check which cell menu item was clicked, you can check the item property inside the cellMenuItem listener.

listeners: {
        cellMenuItem: ({ item }) => {
        	// item is the menu clicked
            	console.log('item', item)
        }
    }

Re: [VUE 3] CellMenuItem Event - get clicked menu item

Posted: Thu Jun 23, 2022 4:26 pm
by info@sundair.com

Hi Márcio,

thank you for the fast answer. This is simple and exactly what i needed. 😊
Think i have missed that item prop..


Re: [VUE 3] CellMenuItem Event - get clicked menu item

Posted: Thu Jun 23, 2022 4:29 pm
by marcio

Hey,

Glad to hear that and to help!