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

CompactTable and row props #91

Open
gius opened this issue Dec 9, 2022 · 2 comments
Open

CompactTable and row props #91

gius opened this issue Dec 9, 2022 · 2 comments

Comments

@gius
Copy link

gius commented Dec 9, 2022

Is it possible to set row props based on the row data in CompactTable? For example, I would like a row background based on the data status (red/green).

If not, could we introduce a new property getRowProps: (item: TableNode, index: number) => CompactRowProps to CompactTableProps? The logic should be that if this property is provided, it would be used to create rowProps that are passed to CompactRow.

@rwieruch
Copy link
Contributor

I would check out the Composed Table and style the rows as you wish over there.

@gius
Copy link
Author

gius commented Dec 12, 2022

Composed table requires a lot of other work (generating columns, cells, etc.) CompactTable is really a great fit for data-heavy apps, its configuration is very straightforward! Only the row-specific props are missing. One would have to copy-paste (and then keep up-to-date with new RCT versions) the whole CompactTable, VirtualizedTable, and NormalTable to add a simple logic like:

(in NormalTable.tsx)
...
      <Body>
        {tableList.map((item: TableNode, index: number) => (
          <CompactRow
            key={item.id}
            index={index}
            item={item}
            columns={columns}
            rowProps={getRowProps ? getRowProps(item, index) : rowProps} // only this has been changed
            rowOptions={rowOptions}
            {...tableProps}
          />
        ))}
      </Body>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants