Custom function on table summary

Hello

It would be nice to be able to use a custom function on the summary row of the new table component.
For example, I have a column with percentages and I want to have the global percentage for all row, but the average function does not work since the percentages don't have the same weight.

Also, it could be nice to disable the label of the type of function, it takes a bit of space on the cell on my really crowded tables :slight_smile:

1 Like

Hi @vbocquel, could you provide more details about how the weight of the percentage from each row should have different weight over the total average? How we implement the custom function will depend on your use case.

For example,

In a users table, if we wanted to reduce the weight of the percentage of a row in half, if the user is an admin (for some reason :smiling_imp:).


We could use a Transformer to do this. In it, iterate over the data that comes back from the query and use JS to decide how much weight each percentage should have, according to a given condition.


Unfortunately, there is not a way to disable the label of the type of function for the summary row. But we could assign the value of this custom "Transformer" to a different component, like a "Text" component and place it below the table:

"Text" component:


Let us know if you have any questions! :slightly_smiling_face:

Hi @Paulo

Thanks for taking some time on this one.

I should have provided an example to make things clearer maybe.
Here's one I've quickly set up :
image
The summary for the "ratio" column should be 17.64% (which is 3/17) and not the 23.33% that comes from using the values of the column.

Thanks for the alternative proposal, that's kind of what we used to do on the legacy table component for any summary kind (adding text on the header cells of the column, or a second table below using the same column structure) but with a bit of extra work on our side. So that's why the new summary row was so full of hopes :wink:

@vbocquel, you are welcome! I found a FR for a custom summary row, I added your +1 to it. :slightly_smiling_face:

1 Like

@avihu I'm pinning you here for you to get notified when there are updates on the feature request.

1 Like