Skip to content
This repository has been archived by the owner on Jan 15, 2022. It is now read-only.

Can the value of a column be a function? #360

Open
Dashman99 opened this issue Feb 14, 2017 · 2 comments
Open

Can the value of a column be a function? #360

Dashman99 opened this issue Feb 14, 2017 · 2 comments

Comments

@Dashman99
Copy link

For example if I have a column called Number and a column Total, can I create a column which displays the percentage of total PercentOfTotal ?

Something like this, assuming I had a function called getPercentOfTotal(a, b)

<Thead>
   <Th column="Number">Number</Th>
   <Th column="Total">Total</Th>
   <Th column={getPercentOfTotal(Number, Total)}>PercentOfTotal</Th>
</Thead>
@brinley
Copy link

brinley commented Mar 28, 2017

Cant see any reason a column is dynamic but I'm sure it would work as long as your function returns the same string as the corresponding Td column

@andrewlorenz
Copy link

this doesn't work. Shame you say you can't see any reason for this, I can ! It would be great if the columns array / Th had an optional value= parameter, to supply a function that can be called with that column's row data values to apply (say) formatting, or to translate, or to compute a value.

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

No branches or pull requests

3 participants