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

GroupItemMetaDataProvider implements SlickPlugin #955

Closed
wants to merge 2 commits into from

Conversation

jesenko
Copy link
Contributor

@jesenko jesenko commented Dec 29, 2023

As it needs to be registered as plugin on grid to work properly, it should implement SlickGrid plugin interface, so typechecking of grid.registerPlugin(groupItemMetadataProvider) succeeds.

As it needs to be registered as plugin on grid to work properly, it should
implement SlickGrid plugin interface, so typechecking of
`grid.registerPlugin(groupItemMetadataProvider)` succeeds.
…ry value

Grouping logic groups items based on equality of returned grouping values;
probably does not need to be string. For example, we are using it to group based
on Date value (by e.g. rounding them to nearest whole hour). If string is
required by the grouping function, additional conversion of Date to string is
needed, which we would rather avoid for perf reasons.
@@ -3,7 +3,7 @@ import { GroupingComparerItem } from "./groupingComparerItem.interface";
import { GroupingFormatterItem } from "./groupingFormatterItem.interface";
import { SortDirectionNumber } from "./sortDirectionNumber.enum";

export type GroupingGetterFunction<T = any> = (value: T) => string;
export type GroupingGetterFunction<T = any> = (value: T) => any;
Copy link
Collaborator

@ghiscoding ghiscoding Dec 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are you converting this to any? It should always be a string since we're referencing a column name

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will open two separate PRs (one for GroupItemMetaDataProvider and other for GroupingGetterFunction. I accidentally created MR from our master branch

About any; not sure if it is the right approach; GroupingGetterFunction is free to return anything I guess, only equality of the returned values is taken into account in the underlying slickgrid logic. I guess it is valid that grouping getter returns number for some rows string for others? Not sure how to type that differently than any? Maybe unknown would be better to force explicit typing when specific return type of grouper might be needed?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I again disagree, it should always be a string, we're always looking to return a column name (name). This is not about what is being grouped, it's about the column name to find via the getter property of the group. Unless I missed something, if so prove me wrong because I won't accept this being changed from string

@jesenko
Copy link
Contributor Author

jesenko commented Dec 29, 2023

Will close this pull request and open two separate PR (should not be creating MR from mater branch of our fork)

@jesenko jesenko closed this Dec 29, 2023
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 this pull request may close these issues.

2 participants