eclipse-tractusx / portal-shared-components

Portal Shared UI Components
https://eclipse-tractusx.github.io/portal-shared-components
Apache License 2.0
1 stars 13 forks source link

Adjustment to Table Component AutoHeight Parameter #234

Closed jjeroch closed 3 weeks ago

jjeroch commented 3 months ago

Ticket Summary:

This ticket addresses an issue with the autoHeight parameter of the Table component which is not functioning as expected in Storybook.

Issue Description:

Tasks:

  1. Investigate and Identify Cause:

    • Determine why the autoHeight parameter is not working as documented.
  2. Code Adjustment:

    • Adjust the implementation of the autoHeight parameter to ensure it functions correctly.
    • Conduct thorough testing to validate the fix.
  3. Impact Analysis:

    • Analyze the potential impact of this change on existing frontends utilizing the Table component.
    • Document the changes and their expected behavior for developers.

Acceptance Criteria:

Implementation Notes:

Technical Details:

Communication Plan:

manojava-gk commented 2 months ago

@jjeroch Fundamental understanding of autoheight seems wrong here. autoheight is not meant to handle the auto height of a row. If a table is wrapped in container and the height has to be dynamic, then autoheight helps to do so.

ex:

<Box sx={{ height: 100, width: "100%" }}>
      <DataGrid
        autoHeight={false}
       rows=[
{
    id: 1,
    lastName: "Snow",
    firstName: "Jon",
    age: 14
  },
  { id: 2, lastName: "Lannister", firstName: "Cersei", age: 31 },
  { id: 3, lastName: "Lannister", firstName: "Jaime", age: 31 },
  { id: 4, lastName: "Stark", firstName: "Arya", age: 11 },
  { id: 5, lastName: "Targaryen", firstName: "Daenerys", age: null },
  { id: 6, lastName: "Melisandre", firstName: null, age: 150 },
  { id: 7, lastName: "Clifford", firstName: "Ferrara", age: 44 },
  { id: 8, lastName: "Frances", firstName: "Rossini", age: 36 },
  { id: 9, lastName: "Roxie", firstName: "Harvey", age: 65 }]
 />
</Box>
Screenshot 2024-07-22 at 11 25 18 AM
<Box sx={{ height: 100, width: "100%" }}>
      <DataGrid
        autoHeight={true}
       rows=[
{
    id: 1,
    lastName: "Snow",
    firstName: "Jon",
    age: 14
  },
  { id: 2, lastName: "Lannister", firstName: "Cersei", age: 31 },
  { id: 3, lastName: "Lannister", firstName: "Jaime", age: 31 },
  { id: 4, lastName: "Stark", firstName: "Arya", age: 11 },
  { id: 5, lastName: "Targaryen", firstName: "Daenerys", age: null },
  { id: 6, lastName: "Melisandre", firstName: null, age: 150 },
  { id: 7, lastName: "Clifford", firstName: "Ferrara", age: 44 },
  { id: 8, lastName: "Frances", firstName: "Rossini", age: 36 },
  { id: 9, lastName: "Roxie", firstName: "Harvey", age: 65 }]
 />
</Box>
Screenshot 2024-07-22 at 11 25 27 AM

In the above example when autoheight is false UI screwed as the height is set to 100px. But when it changed to true height adjusted for the whole container