-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from Infineon/39-option-to-display-some-action…
…s-in-a-popup-menu-instead-of-the-actions-column Enhancement: Option to display some actions in a popup menu instead of the actions column
- Loading branch information
Showing
6 changed files
with
208 additions
and
14 deletions.
There are no files selected for viewing
73 changes: 73 additions & 0 deletions
73
examples/src/components/examples/ExamplePopupMenuActions.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<template> | ||
<div> | ||
<InfineonDatatable | ||
:data="rows" | ||
:columns="columns" | ||
:default-sort="{ key: 'name', type: 'D' }" | ||
:can-edit="true" | ||
:additional-actions="[ { | ||
title: 'Print to Console.log', | ||
label: 'Console.log', | ||
action: logToConsole, | ||
icon: ['fas', 'exclamation-triangle']}, | ||
]" | ||
:popup-menu-actions="[ { | ||
title: 'Open an alert box', | ||
label: 'Alert', | ||
action: showAlert, | ||
icon: ['fas', 'terminal'] | ||
}, | ||
{ | ||
title: 'Open an alert box', | ||
label: 'Alert', | ||
action: showAlert, | ||
icon: ['fas', 'terminal'], | ||
canCloseMenu: true | ||
} ]" | ||
@on-menu-button-click="onMenuOpened" | ||
/> | ||
<!-- don't forget to load any fontawesome icons in /plugins/fontawesome.js!! --> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { InfineonDatatable } from '../../../../lib'; | ||
const logToConsole = (row) => { | ||
// eslint-disable-next-line no-console | ||
console.log('we print to current row to console'); | ||
// eslint-disable-next-line no-console | ||
console.log(row); | ||
}; | ||
const showAlert = (row) => { | ||
// eslint-disable-next-line no-alert | ||
alert(JSON.stringify(row)); | ||
}; | ||
const onMenuOpened = (row) => { | ||
console.log(`Menu triggered for row ${row.id}`) | ||
} | ||
const rows = [ | ||
{ id: 1, name: 'item1' }, | ||
{ id: 2, name: 'item2' }, | ||
{ id: 3, name: 'item3' }, | ||
{ id: 4, name: 'item4' }, | ||
]; | ||
const columns = [ | ||
{ | ||
key: 'id', | ||
title: 'ID column title', | ||
sortable: true, | ||
sortType: 'NUMBER', | ||
}, | ||
{ | ||
key: 'name', | ||
title: 'Name', | ||
sortable: true, | ||
sortType: 'STRING', | ||
}, | ||
]; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters