diff --git a/client/src/app/pages/applications/applications-table/components/manage-columns-modal.tsx b/client/src/app/pages/applications/applications-table/components/manage-columns-modal.tsx index d2c402916f..8f7cd074e7 100644 --- a/client/src/app/pages/applications/applications-table/components/manage-columns-modal.tsx +++ b/client/src/app/pages/applications/applications-table/components/manage-columns-modal.tsx @@ -74,14 +74,26 @@ export const ManageColumnsModal = ({ ); }; - const onDrop = (sourceIndex: any, destinationIndex: any) => { + const onDrop = (sourceIndex: any, destinationIndex: any): boolean => { + if ( + typeof sourceIndex !== "number" || + typeof destinationIndex !== "number" + ) { + return false; + } + const result = Array.from(editedColumns); const [removed] = result.splice(sourceIndex, 1); result.splice(destinationIndex, 0, removed); setEditedColumns(result); + + // Assuming the operation is successful + return true; }; const onSelect = (id: any, isVisible: any) => { + console.log(`Toggling visibility for ${id}: ${isVisible}`); + setEditedColumns( editedColumns.map((col) => ({ ...col, @@ -127,8 +139,7 @@ export const ManageColumnsModal = ({ , ]} > - {/* onDrop(source.index, dest?.index)}> */} - + onDrop(source.index, dest?.index)}> {editedColumns.map(({ id, label, isVisible }, index) => ( @@ -140,7 +151,7 @@ export const ManageColumnsModal = ({ onSelect(id, checked)} + onChange={(e, checked) => onSelect(id, checked)} /> - - -