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

How to pass a function to certain column formatting #37

Open
jameshall9 opened this issue Feb 5, 2025 · 1 comment
Open

How to pass a function to certain column formatting #37

jameshall9 opened this issue Feb 5, 2025 · 1 comment

Comments

@jameshall9
Copy link

Per the documentation here there is the ability to pass a function for certain parameters of the column formatter but when I try passing something like:

{"title":"Example", "field" : "example", "formatter" : "progress", "formatterParams" : { "min" : 0, "max" : 10, "color" : ["green", "orange", "red"], 'legend': "function(value) { return value + '%'; }" "legendColor" : "#000000", "legendAlign":"center", }}

I just end up with the table displaying the text "function(value) { return value + '%'; }" in each cell for that column.

This maybe a user error rather than a bug...

@CrystalWindSnake
Copy link
Owner

@jameshall9 Hi, If the parameter is a JavaScript function, you need to prepend a colon to the key.

":cellClick": 'function(e, cell){emitEvent("cellClick","name")}',

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