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

Registering custom aggFunc(s) to grid not working #278

Closed
DavidBord opened this issue Mar 19, 2024 · 4 comments · Fixed by #286
Closed

Registering custom aggFunc(s) to grid not working #278

DavidBord opened this issue Mar 19, 2024 · 4 comments · Fixed by #286

Comments

@DavidBord
Copy link

On propCategories.js aggFuncs is defined under GRID_MAYBE_FUNCTIONS where it assumed it is only a function but it is a dict where function names are the keys and functions are the values. Perhaps it should be defined under OBJ_OF_FUNCTIONS or a new category for OBJ_OF_MAYBE_FUNCTIONS?

@BSd3v
Copy link
Collaborator

BSd3v commented Mar 19, 2024

Can you please provide an example of how you are proposing it should work?

We use this type of function in one other place, where it can be an object or a function.

@DavidBord
Copy link
Author

Looking at the example from the documentation, I would expect that if I set:
aggFuncs={"function": "ratioAggFunc(params)"}
And enable the sidebar with:
sidebar=True
Then when grouping I could replace one of the built-in agg funcs (sum, max etc) with ratioAggFunc but it is not available.

@BSd3v
Copy link
Collaborator

BSd3v commented Mar 21, 2024

If you pass it like this:

aggFuncs={"function": "ratioAggFunc(params)"}

It is expecting you to return an object from the function as a map of the associated functions.

aggFuncs={"function": "customAggFuncs"}

dagFuncs.customAggFuncts = () => {
    return {
    "ratioAggFunc": "ratioAggFunc"
    }
}

Let me know if this works.

The other way I am looking at is this:

'aggFuncs': {'ratioAggFunc': {"function": "ratioAggFunc"}}

@DavidBord
Copy link
Author

This does not work.

@BSd3v BSd3v linked a pull request Apr 22, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants