diff --git a/docs/components/table-view.md b/docs/components/table-view.md index 5105719a72..9b1c33f90e 100644 --- a/docs/components/table-view.md +++ b/docs/components/table-view.md @@ -544,7 +544,7 @@ A boolean to enable expanding each table row. Useful for providing additional in ``` -### hideHeader +### hideHeaders A boolean to hide table headers. Only recomended when used in nested table. Refer to [Expandable Rows](#expandable-rows) section documentation for more details. Defaults to `false`. @@ -719,7 +719,7 @@ Both parent and nested tables in this example contain static data for demonstrat A nested table that complements the parent table requires some special handling: * The `nested` prop must be set to `true` -* Table headers can be hidden using the [`hideHeader` prop](#hideheader). Value still need to be passed through the `headers` prop, and this is where the `nestedHeaders` slot prop becomes useful. It returns an array of header objects, simplifying the synchronization of column visibility when it is enabled in the parent table +* Table headers can be hidden using the [`hideHeaders` prop](#hideHeaders). Value still need to be passed through the `headers` prop, and this is where the `nestedHeaders` slot prop becomes useful. It returns an array of header objects, simplifying the synchronization of column visibility when it is enabled in the parent table * To better align the columns of the parent and nested tables, the `columnWidths` slot prop can be utilized. It returns an object that can be passed to the nested table through the [`tablePreferences` prop](#tablepreferences). Each time a column is resized in the parent table, the nested table will be updated accordingly :::warning NOTE @@ -748,7 +748,7 @@ If bulk actions is enabled in parent table, it will be disabled in the nested ta import { ref } from 'vue' import { AddIcon, SearchIcon, MoreIcon } from '@kong/icons' diff --git a/sandbox/pages/SandboxTableView/SandboxTableView.vue b/sandbox/pages/SandboxTableView/SandboxTableView.vue index 5ddc3ef2a7..8ee31481eb 100644 --- a/sandbox/pages/SandboxTableView/SandboxTableView.vue +++ b/sandbox/pages/SandboxTableView/SandboxTableView.vue @@ -281,7 +281,7 @@ { }) }) - it('does not display table header when hideHeader prop is true', () => { + it('emits row-expand event when row is expanded', () => { mount(KTableView, { props: { headers: options.headers, data: options.data, - hideHeader: true, + expandableRows: true, + }, + }) + + cy.getTestId('expandable-row-control').eq(0).click().then(() => { + cy.wrap(Cypress.vueWrapper.emitted()).should('have.property', 'row-expand').and('have.length', 1) + }) + }) + + + it('does not display table header when hideHeaders prop is true', () => { + mount(KTableView, { + props: { + headers: options.headers, + data: options.data, + hideHeaders: true, }, }) diff --git a/src/components/KTableView/KTableView.vue b/src/components/KTableView/KTableView.vue index d52e27ff32..393b3fedaf 100644 --- a/src/components/KTableView/KTableView.vue +++ b/src/components/KTableView/KTableView.vue @@ -1,7 +1,7 @@