Skip to content

Commit d3ee05d

Browse files
Merge pull request #218 from terminusdb/newDoc
fix button click
2 parents d271ac8 + 1d05c84 commit d3ee05d

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

packages/tdb-documents-ui-template/src/components/DocumentsGraphqlTable.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,24 @@ export const DocumentsGraphqlTable = ({gqlQuery,apolloClient,tableConfig, type,
5656
}
5757
}
5858

59-
const deleteAction =(row)=>{
59+
const deleteAction =(evt,row)=>{
60+
evt.stopPropagation()
6061
if (onDeleteButtonClick) {
6162
const rowTmp = row && row.original ? {label:row.original.name, id:row.original.fullID}: {}
6263
onDeleteButtonClick(rowTmp)
6364
}
6465
}
6566

66-
const viewAction =(row)=>{
67+
const viewAction =(evt,row)=>{
68+
evt.stopPropagation()
6769
if (onViewButtonClick) {
6870
const rowTmp = row && row.original ? {label:row.original.name, id:row.original.fullID}: {}
6971
onViewButtonClick(rowTmp)
7072
}
7173
}
7274

73-
const editAction =(row)=>{
75+
const editAction =(evt,row)=>{
76+
evt.stopPropagation()
7477
if (onEditButtonClick) {
7578
const rowTmp = row && row.original ? {label:row.original.name, id:row.original.fullID}: {}
7679
onEditButtonClick(rowTmp)
@@ -83,13 +86,13 @@ export const DocumentsGraphqlTable = ({gqlQuery,apolloClient,tableConfig, type,
8386
//const name = cell.row.original['name']
8487
return <React.Fragment>
8588
<span className="d-flex justify-content-end mr-4">
86-
{onViewButtonClick && <Button variant="success" size="sm" className="ml-3" title={`view document`} onClick={() => viewAction(invFullId)}>
89+
{onViewButtonClick && <Button variant="success" size="sm" className="ml-3" title={`view document`} onClick={(evt) => viewAction(evt,invFullId)}>
8790
<HiOutlineDocument/>
8891
</Button>}
89-
{onEditButtonClick && <Button variant="success" size="sm" className="ml-3" title={`edit document`} onClick={() => editAction(invFullId)}>
92+
{onEditButtonClick && <Button variant="success" size="sm" className="ml-3" title={`edit document`} onClick={(evt) => editAction(evt,invFullId)}>
9093
<RiEdit2Fill/>
9194
</Button>}
92-
{onDeleteButtonClick && <Button variant="danger" size="sm" className="ml-3" title={`delete document`} onClick={() => deleteAction(invFullId)}>
95+
{onDeleteButtonClick && <Button variant="danger" size="sm" className="ml-3" title={`delete document`} onClick={(evt) => deleteAction(evt,invFullId)}>
9396
<RiDeleteBin7Line/>
9497
</Button>}
9598
</span>

packages/tdb-documents-ui/src/helpers/displayHelper.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ function getOneOfFormData (props, args) {
263263
})
264264
return populatedFormData
265265
}
266+
return {}
266267
}
267268

268269
// ONE OF

0 commit comments

Comments
 (0)