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

Expand default column / header options #333

Merged
merged 3 commits into from
Jan 27, 2025

Conversation

tmikoss
Copy link
Contributor

@tmikoss tmikoss commented Jan 27, 2025

Based on feedback in #332

  • Expand default column options to allow setting a global header naming scheme
  • Add default filter options

* Expand default column options to allow setting a global header naming scheme
* Add default filter options
@tmikoss
Copy link
Contributor Author

tmikoss commented Jan 27, 2025

WIP, avaiting your feedback @bogdan

The main issue I ran into while implementing - default_column_options already exists, and it expects an object, instead of a proc. And making default_filter_options the other way around would not make sense.

I've started with converting header proc to receive column / filter definition in params. But I suppose to be truly useful, others should have that logic too.

Would it make sense to give the whole default_column_options the callable treatment, allow it to be either an object, or column -> object proc? And same with filter?

Edit: The more I think about it, the more it seems that the only way for this feature to be flexible enough is by passing column / filter instance to the proc. Otherwise there would be either too many changes to other options beside header, or questions of "well why not this one?" sort. Updated the implementation. If the idea itself looks solid, I'll go about updating docs / tests.

Copy link
Owner

@bogdan bogdan left a comment

Choose a reason for hiding this comment

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

Looks way better than I expected! Please add/update the doc on the new options.

spec/datagrid/columns_spec.rb Show resolved Hide resolved
lib/datagrid/core.rb Show resolved Hide resolved
@tmikoss tmikoss requested a review from bogdan January 27, 2025 18:29
@bogdan bogdan merged commit a47950d into bogdan:main Jan 27, 2025
6 checks passed
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