Skip to content

Commit

Permalink
do not show add and delete buttons on non editable tables (#1711)
Browse files Browse the repository at this point in the history
* do not show add and delete buttons on non editable tables
resolves #1710

* missing dep

---------

Co-authored-by: Fred Lefévère-Laoide <[email protected]>
  • Loading branch information
FredLL-Avaiga and Fred Lefévère-Laoide committed Aug 27, 2024
1 parent 4c4ff12 commit 2698632
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions frontend/taipy-gui/src/components/Taipy/AutoLoadingTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ const AutoLoadingTable = (props: TaipyTableProps) => {
selection: selected,
formatConfig: formatConfig,
onValidation: active && onEdit ? onCellValidation : undefined,
onDeletion: active && onDelete ? onRowDeletion : undefined,
onDeletion: active && editable && onDelete ? onRowDeletion : undefined,
onRowSelection: active && onAction ? onRowSelection : undefined,
onRowClick: active && onAction ? onRowClick : undefined,
lineStyle: props.lineStyle,
Expand All @@ -557,6 +557,7 @@ const AutoLoadingTable = (props: TaipyTableProps) => {
columns,
selected,
formatConfig,
editable,
onEdit,
onCellValidation,
onDelete,
Expand Down Expand Up @@ -588,7 +589,7 @@ const AutoLoadingTable = (props: TaipyTableProps) => {
>
{columns[col].dfid === EDIT_COL ? (
[
active && onAdd ? (
active && editable && onAdd ? (
<Tooltip title="Add a row" key="addARow">
<IconButton
onClick={onAddRowClick}
Expand Down
6 changes: 4 additions & 2 deletions frontend/taipy-gui/src/components/Taipy/PaginatedTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ const PaginatedTable = (props: TaipyPaginatedTableProps) => {
>
{columns[col].dfid === EDIT_COL ? (
[
active && onAdd ? (
active && editable && onAdd ? (
<Tooltip title="Add a row" key="addARow">
<IconButton
onClick={onAddRowClick}
Expand Down Expand Up @@ -594,7 +594,9 @@ const PaginatedTable = (props: TaipyPaginatedTableProps) => {
? onCellValidation
: undefined
}
onDeletion={active && onDelete ? onRowDeletion : undefined}
onDeletion={
active && editable && onDelete ? onRowDeletion : undefined
}
onSelection={active && onAction ? onRowSelection : undefined}
nanValue={columns[col].nanValue || props.nanValue}
tooltip={getTooltip(row, columns[col].tooltip, col)}
Expand Down

0 comments on commit 2698632

Please sign in to comment.