Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(data-table): radio button all selection option disabled #11670

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import { html } from 'lit';
import { boolean, select, text } from '@storybook/addon-knobs';
import Settings16 from '@carbon/web-components/es/icons/settings/16';
import { prefix } from '../../../globals/settings';
import { TABLE_SIZE } from '../table';
import '../index';
Expand Down Expand Up @@ -105,9 +106,32 @@ export const WithRadioSelection = () => {
<cds-table-header-description slot="description"
>With selection</cds-table-header-description
>

<cds-table-toolbar slot="toolbar">
<cds-table-toolbar-content>
<cds-table-toolbar-search
placeholder="Filter table"></cds-table-toolbar-search>
<cds-overflow-menu toolbar-action>
${Settings16({
slot: 'icon',
class: `${prefix}--overflow-menu__icon`,
})}
<cds-overflow-menu-body>
<cds-overflow-menu-item @click=${() => alert('Alert 1')}>
Action 1
</cds-overflow-menu-item>
<cds-overflow-menu-item @click=${() => alert('Alert 2')}>
Action 2
</cds-overflow-menu-item>
<cds-overflow-menu-item @click=${() => alert('Alert 3')}>
Action 3
</cds-overflow-menu-item>
</cds-overflow-menu-body>
</cds-overflow-menu>
<cds-button>Primary button</cds-button>
</cds-table-toolbar-content>
</cds-table-toolbar>
<cds-table-head>
<cds-table-header-row selection-name="header" hide-checkbox>
<cds-table-header-row>
<cds-table-header-cell>Name</cds-table-header-cell>
<cds-table-header-cell>Protocol</cds-table-header-cell>
<cds-table-header-cell>Port</cds-table-header-cell>
Expand All @@ -117,7 +141,7 @@ export const WithRadioSelection = () => {
</cds-table-header-row>
</cds-table-head>
<cds-table-body>
<cds-table-row selection-name="0">
<cds-table-row>
<cds-table-cell>Load Balancer 3</cds-table-cell>
<cds-table-cell>HTTP</cds-table-cell>
<cds-table-cell>3000</cds-table-cell>
Expand All @@ -127,23 +151,23 @@ export const WithRadioSelection = () => {
><cds-link disabled>Disabled</cds-link></cds-table-cell
>
</cds-table-row>
<cds-table-row selection-name="1">
<cds-table-row>
<cds-table-cell>Load Balancer 1</cds-table-cell>
<cds-table-cell>HTTP</cds-table-cell>
<cds-table-cell>443</cds-table-cell>
<cds-table-cell>Round robin</cds-table-cell>
<cds-table-cell>Maureen's VM Groups</cds-table-cell>
<cds-table-cell><cds-link>Starting</cds-link></cds-table-cell>
</cds-table-row>
<cds-table-row selection-name="2">
<cds-table-row>
<cds-table-cell>Load Balancer 2</cds-table-cell>
<cds-table-cell>HTTP</cds-table-cell>
<cds-table-cell>80</cds-table-cell>
<cds-table-cell>DNS delegation</cds-table-cell>
<cds-table-cell>Andrew's VM Groups</cds-table-cell>
<cds-table-cell><cds-link>Active</cds-link></cds-table-cell>
</cds-table-row>
<cds-table-row selection-name="3">
<cds-table-row>
<cds-table-cell>Load Balancer 6</cds-table-cell>
<cds-table-cell>HTTP</cds-table-cell>
<cds-table-cell>3000</cds-table-cell>
Expand All @@ -153,15 +177,15 @@ export const WithRadioSelection = () => {
><cds-link disabled>Disabled</cds-link></cds-table-cell
>
</cds-table-row>
<cds-table-row selection-name="4">
<cds-table-row>
<cds-table-cell>Load Balancer 4</cds-table-cell>
<cds-table-cell>HTTP</cds-table-cell>
<cds-table-cell>443</cds-table-cell>
<cds-table-cell>Round robin</cds-table-cell>
<cds-table-cell>Mel's VM Groups</cds-table-cell>
<cds-table-cell><cds-link>Starting</cds-link></cds-table-cell>
</cds-table-row>
<cds-table-row selection-name="5">
<cds-table-row>
<cds-table-cell>Load Balancer 5</cds-table-cell>
<cds-table-cell>HTTP</cds-table-cell>
<cds-table-cell>80</cds-table-cell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,12 @@ class CDSTable extends HostListenerMixin(LitElement) {
}

if (changedProperties.has('isSelectable')) {
if (this.isSelectable) {
if (this.isSelectable || this.hasAttribute('radio')) {
if (this.hasAttribute('radio')) {
this._tableHeaderRow.setAttribute('hide-checkbox', '');
} else {
this._tableHeaderRow.setAttribute('selection-name', 'header');
}
this._tableHeaderRow.setAttribute('selection-name', 'header');
this._tableRows.forEach((e, index) => {
if (!e.hasAttribute('selection-name')) {
Expand Down Expand Up @@ -1005,6 +1010,12 @@ class CDSTable extends HostListenerMixin(LitElement) {
static get selectorTableRow() {
return `${prefix}-table-row`;
}
/**
* The CSS selector to find the table
*/
static get selectorTable() {
return `${prefix}-table`;
}

/**
* The CSS selector to find the rows cells.
Expand Down
Loading