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

Highlight KtTable rows #702

Open
Isokaeder opened this issue Jan 17, 2023 · 0 comments
Open

Highlight KtTable rows #702

Isokaeder opened this issue Jan 17, 2023 · 0 comments

Comments

@Isokaeder
Copy link
Collaborator

With the Kotti table we want to have the possibility of highlighting certain rows. See the design here

The basic idea is to have highlighted cells. This can be achieved easily by using a class. But since the highlighted cell or rather its column could be hidden or out of screen, we need a failsafe way to communicate to the user that a table row contains one of those highlighted cells.

This is not possible right now. You can only apply custom styles to all rows at once using the tables trClasses prop.

To change this, highlighting could become a feature supported by kotti itself, which would then take care of also highlighting the row. For this my proposal would be a prop on a KtTableColumn like highlightFunction that has a similar signature to the validator function in KtField*:

declare function highlightFunction (row: T) => 'warning' | 'error' | 'success' | 'empty'

With that in place, we could see both for individual cells if they should be highlighted and (with changes to the column store I assume) for a row if a highlighted cell is contained and should therefore be highlighted.

Alternatively, it should be possible to apply classes to table individually, based on the row's content. In that scenario I would propose two expand trClasses to also accept a Function with this signature:

declare function trClasses (row: t) => string

In that scenario, the exact logic of highlighting needs to be handled by the client side code.

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

1 participant