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

Export defaultColumn options from data grid #3587

Open
mhwaage opened this issue Aug 14, 2024 · 0 comments
Open

Export defaultColumn options from data grid #3587

mhwaage opened this issue Aug 14, 2024 · 0 comments

Comments

@mhwaage
Copy link
Contributor

mhwaage commented Aug 14, 2024

Is your feature request related to a problem? Please describe.

In our application, we want to format displayed numbers in cells. Since we don't know a-priori which columns will have number values, we do this with by setting defaultColumn:

[...]
const defaultColumn= {
cell: (props) => {
      const v = props.getValue();
      if (typeof v === "number") {
        return v.toPrecision(3);
      }
      return v;
    },
}
<EdsDataGrid
  defaultColumn={defaultColumn}
/>

unfortunately, this means that we remove the existing default behaviour, instead of the intention, which would be to extend it. To allow doing either, it would be nice if the current defaultColumn settings could be exported.

Describe the solution you'd like

export const defaultColumn = ...;

Describe alternatives you've considered

  • extendDefaultColumn prop, which extends instead of overwriting
  • type of eds defaultColumn could be (context, currentDefaultoptions) => displayValue instead of (context) => displayValue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant