فهرست منبع

do not show add and delete buttons on non editable tables (#1711)

* do not show add and delete buttons on non editable tables
resolves #1710

* missing dep

---------

Co-authored-by: Fred Lefévère-Laoide <Fred.Lefevere-Laoide@Taipy.io>
Fred Lefévère-Laoide 8 ماه پیش
والد
کامیت
26986326df

+ 3 - 2
frontend/taipy-gui/src/components/Taipy/AutoLoadingTable.tsx

@@ -541,7 +541,7 @@ const AutoLoadingTable = (props: TaipyTableProps) => {
             selection: selected,
             selection: selected,
             formatConfig: formatConfig,
             formatConfig: formatConfig,
             onValidation: active && onEdit ? onCellValidation : undefined,
             onValidation: active && onEdit ? onCellValidation : undefined,
-            onDeletion: active && onDelete ? onRowDeletion : undefined,
+            onDeletion: active && editable && onDelete ? onRowDeletion : undefined,
             onRowSelection: active && onAction ? onRowSelection : undefined,
             onRowSelection: active && onAction ? onRowSelection : undefined,
             onRowClick: active && onAction ? onRowClick : undefined,
             onRowClick: active && onAction ? onRowClick : undefined,
             lineStyle: props.lineStyle,
             lineStyle: props.lineStyle,
@@ -557,6 +557,7 @@ const AutoLoadingTable = (props: TaipyTableProps) => {
             columns,
             columns,
             selected,
             selected,
             formatConfig,
             formatConfig,
+            editable,
             onEdit,
             onEdit,
             onCellValidation,
             onCellValidation,
             onDelete,
             onDelete,
@@ -588,7 +589,7 @@ const AutoLoadingTable = (props: TaipyTableProps) => {
                                         >
                                         >
                                             {columns[col].dfid === EDIT_COL ? (
                                             {columns[col].dfid === EDIT_COL ? (
                                                 [
                                                 [
-                                                    active && onAdd ? (
+                                                    active && editable && onAdd ? (
                                                         <Tooltip title="Add a row" key="addARow">
                                                         <Tooltip title="Add a row" key="addARow">
                                                             <IconButton
                                                             <IconButton
                                                                 onClick={onAddRowClick}
                                                                 onClick={onAddRowClick}

+ 4 - 2
frontend/taipy-gui/src/components/Taipy/PaginatedTable.tsx

@@ -482,7 +482,7 @@ const PaginatedTable = (props: TaipyPaginatedTableProps) => {
                                         >
                                         >
                                             {columns[col].dfid === EDIT_COL ? (
                                             {columns[col].dfid === EDIT_COL ? (
                                                 [
                                                 [
-                                                    active && onAdd ? (
+                                                    active && editable && onAdd ? (
                                                         <Tooltip title="Add a row" key="addARow">
                                                         <Tooltip title="Add a row" key="addARow">
                                                             <IconButton
                                                             <IconButton
                                                                 onClick={onAddRowClick}
                                                                 onClick={onAddRowClick}
@@ -594,7 +594,9 @@ const PaginatedTable = (props: TaipyPaginatedTableProps) => {
                                                             ? onCellValidation
                                                             ? onCellValidation
                                                             : undefined
                                                             : undefined
                                                     }
                                                     }
-                                                    onDeletion={active && onDelete ? onRowDeletion : undefined}
+                                                    onDeletion={
+                                                        active && editable && onDelete ? onRowDeletion : undefined
+                                                    }
                                                     onSelection={active && onAction ? onRowSelection : undefined}
                                                     onSelection={active && onAction ? onRowSelection : undefined}
                                                     nanValue={columns[col].nanValue || props.nanValue}
                                                     nanValue={columns[col].nanValue || props.nanValue}
                                                     tooltip={getTooltip(row, columns[col].tooltip, col)}
                                                     tooltip={getTooltip(row, columns[col].tooltip, col)}