add clone button

This commit is contained in:
lightling 2025-03-23 23:21:49 -04:00
parent cb84ace3cf
commit ba64bd62b4
Signed by: lightling
GPG key ID: F1F29650D537C773

View file

@ -101,6 +101,11 @@ const onEditRow = (event: Event, slotProps: EditingRow) => {
editingRowData.value = slotProps
}
const onCloneRow = (event: Event, slotProps: EditingRow) => {
event.preventDefault()
onAddRow(undefined, slotProps.data)
}
const onRemoveImage = (event: Event, slotProps: EditingRow) => {
event.preventDefault()
const row = { ...model.value[slotProps.index] } as any
@ -285,7 +290,7 @@ DataTable.data-editor(
Column(
rowEditor
header='Actions'
style='width:10%;min-width:8rem;'
style='width:10%;min-width:14rem;'
bodyStyle='text-align:center;'
)
template(
@ -299,6 +304,14 @@ DataTable.data-editor(
variant='text'
@click='slotProps.editorInitCallback'
)
Button.edit(
icon='pi pi-clone'
aria-label='Row Clone'
rounded
severity='secondary'
variant='text'
@click='(e) => onCloneRow(e, slotProps)'
)
Button.edit(
icon='pi pi-pen-to-square'
aria-label='Row Edit Details'