Skip to content

[Feat]: Add programmatic row expansion support to table component #2125

@nangelov-eti

Description

@nangelov-eti

Is your feature request related to a problem? Please describe.
The table component currently handles row expansion as internal state, preventing developers from controlling expansion behavior externally.

Image

Describe the solution you'd like
Add two new optional properties to the table component like the ones available for the tree component:

Image Image
  1. expandedValues

    • Type: array
    • Default: []
    • Description: Allows developers to explicitly control which rows are expanded by supplying a list of row values/keys.
  2. defaultExpandAllRows

    • Type: boolean
    • Default: false
    • Description: When set to true, all expandable rows should be expanded by default on initial render, similar to the tree component behavior.

Describe alternatives you've considered

  • Using the tree component instead of the table.

Additional context
Below is example hierarchical data used in the table. Parent rows represent collections, and child rows represent individual items. The proposed properties would allow developers to control which collections are expanded and whether all collections should be expanded by default.

[
  {
    "label": "Science Fiction Collection",
    "children": [
      {
        "label": "Dune (Frank Herbert)",
        "value": "{\"isbn\":\"9780441013593\",\"title\":\"Dune\",\"author\":\"Frank Herbert\",\"genre\":\"Science Fiction\",\"collection_id\":201,\"publication_year\":1965,\"language\":\"EN\",\"format\":\"Paperback\",\"availability\":\"Available\"}"
      },
      {
        "label": "Neuromancer (William Gibson)",
        "value": "{\"isbn\":\"9780441569595\",\"title\":\"Neuromancer\",\"author\":\"William Gibson\",\"genre\":\"Cyberpunk\",\"collection_id\":201,\"publication_year\":1984,\"language\":\"EN\",\"format\":\"Hardcover\",\"availability\":\"Checked Out\"}"
      }
    ]
  },
  {
    "label": "Classic Literature",
    "children": [
      {
        "label": "Pride and Prejudice (Jane Austen)",
        "value": "{\"isbn\":\"9780141439518\",\"title\":\"Pride and Prejudice\",\"author\":\"Jane Austen\",\"genre\":\"Romance\",\"collection_id\":202,\"publication_year\":1813,\"language\":\"EN\",\"format\":\"Paperback\",\"availability\":\"Available\"}"
      }
    ]
  },
  {
    "label": "Technology & Programming",
    "children": [
      {
        "label": "Clean Code (Robert C. Martin)",
        "value": "{\"isbn\":\"9780132350884\",\"title\":\"Clean Code\",\"author\":\"Robert C. Martin\",\"genre\":\"Software Engineering\",\"collection_id\":203,\"publication_year\":2008,\"language\":\"EN\",\"format\":\"eBook\",\"availability\":\"Available\"}"
      }
    ]
  }
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions