Skip to content

Commit

Permalink
fix(data-grid): disable clear button when rows are not editable
Browse files Browse the repository at this point in the history
  • Loading branch information
pbullhove committed Mar 12, 2024
1 parent 6f48b21 commit d2ca001
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,18 @@ export function DataGridActions(props: DataGridActionsProps) {
<Icon size={16} data={settings} />
</Styled.ActionRowButton>
</Tooltip>
<Tooltip title='Clear table content'>
<Styled.ActionRowButton
aria-haspopup
aria-expanded={isMenuOpen}
onClick={() => clearTable()}
ref={setMenuButtonAnchor}
>
<Icon size={16} data={delete_to_trash} />
</Styled.ActionRowButton>
</Tooltip>
{functionality.rowsAreEditable && functionality.addButtonIsEnabled && (
<Tooltip title='Clear table content'>
<Styled.ActionRowButton
aria-haspopup
aria-expanded={isMenuOpen}
onClick={() => clearTable()}
ref={setMenuButtonAnchor}
>
<Icon size={16} data={delete_to_trash} />
</Styled.ActionRowButton>
</Tooltip>
)}
<Menu
anchorEl={menuButtonAnchor}
id='table-setting-menu'
Expand Down
6 changes: 5 additions & 1 deletion packages/dm-core-plugins/src/data-grid/DataGridPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ export function DataGridPlugin(props: IUIPlugin) {
}

return !data ? null : (
<Stack className='dm-plugin-padding' alignItems='flex-start' spacing={1}>
<Stack
className='dm-plugin-padding w-full'
alignItems='flex-start'
spacing={1}
>
<DataGrid
attributeType={attribute?.attributeType || 'string'}
config={userConfig}
Expand Down

0 comments on commit d2ca001

Please sign in to comment.