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

Table: Enable row selection event #234

Closed
CristianDDias opened this issue Nov 28, 2019 · 4 comments
Closed

Table: Enable row selection event #234

CristianDDias opened this issue Nov 28, 2019 · 4 comments

Comments

@CristianDDias
Copy link

Is your feature request related to a problem? Please describe.
We are using the Table component but we need to select a table row, which is not possible. We tried to use the AnalyticalTable component but it needs a rowHeight props, which is not possible in our case, because the row height can be different for each table row (dynamic height).

Describe the solution you'd like
An onClick callback function for the table row, which is fired when the user selects a table row. This callback function receives as a parameter the selected row.

Describe alternatives you've considered
Access the shadowRoot of the Table web component and add an onClick event listener for each tr element and expose this callback function.

@vbersch
Copy link
Contributor

vbersch commented Dec 4, 2019

Hi @CristianDDias ,

The AnalyticalTable needs the rowHeight prop because of its built-in virtualization. In theory, it should be possible to achieve dynamic row heights by using react-window's VariableSizeList , but you would need to provide a function which gets the row index as a parameter and returns the rows height. Would that help?

Regarding the Table component: The underlying Table ui5-webcomponent does not support this feature yet. If you choose to go with Table, you´d need to open an issue at ui5-webcomponents

best regards,
Viktor

@CristianDDias
Copy link
Author

CristianDDias commented Dec 4, 2019

Hi @vbersch

I think the VariableSizeList wouldn't help us in this case. In our application, we have a list on the left side and a table on the right side of the screen. By selecting an item from the list, the table will display some rows. Those rows can have small or big strings, so the rows height would depend on the size of the table (table width) and the size of the strings.

I think would be better to use the Table component because it already adjusts the row height according to the size of the content (big or small strings).

Here is a Codesandbox example about what we would expect from the table.

I created an issue for the UI5 Web Components.

@MarcusNotheis
Copy link
Contributor

Hi @CristianDDias

Can we close this issue as this was resolved in the UI5 Web Components Issue thread?
Or do you want to keep it open in order for us to implement the getRowHeight function?

@CristianDDias
Copy link
Author

Hi @MarcusNotheis, you can close the issue. Thanks.

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

3 participants