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

add column Filterfunc #175

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

trevorstarick
Copy link

I think the FilterFunc stuff is pretty solid, but I think I need to spend some more time working on the way that the column sizes are calculated. There's a bunch of unnecessary copying of the m.columns slice.

@trevorstarick trevorstarick changed the title Draft: add column visibility and Filterfunc add column visibility and Filterfunc May 15, 2024
@trevorstarick
Copy link
Author

I'm using both features in tandem locally, but if it makes more sense to have them as two PR then I'll split them

@trevorstarick trevorstarick changed the title add column visibility and Filterfunc add column Filterfunc May 28, 2024
@trevorstarick trevorstarick marked this pull request as ready for review May 28, 2024 15:12
@Evertras
Copy link
Owner

Would we want the filter function on the column or the table?

I'm wondering if the table itself might be better, so that there's a single filter func attached to the table. Then, when filtering, instead of checking the filterable columns, it instead checks the filter func for each row. This would allow someone to use data in the row that isn't in any column, or combine data across columns, etc.

@trevorstarick
Copy link
Author

Would adding both make sense? In my use case I'm filtering on all the data in the table, but I could imagine where a per-column filter makes more sense.

@Evertras
Copy link
Owner

I suppose both would work. Technically you could do everything if you had the table-wide filter, but you would have to go through the extra step of checking for the column yourself. So having a shortcut on the columns could be nicer in some situations.

My only concern would be clarity of use. If I define a column filter, and a table filter, what happens? How can that be made clear? 🤔

@trevorstarick
Copy link
Author

trevorstarick commented Jun 12, 2024

My only concern would be clarity of use. If I define a column filter, and a table filter, what happens? How can that be made clear? 🤔

That's a good point. In that case, I think I should refactor my changes to focus on just the table-level filtering. If I hit a case where that isn't good enough in the tools I'm working on, I'll see if I can come up with a solid solution to the table vs column filter.

One quick way I think would solve the issue is if all the filters get popped into an array, and the results are OR'd together, but then someone will want to do just ANDs which means having to also have a toggle for the "joining" of the filters. In my experience dealing with a collection of filters is a pain 🫤

@Evertras
Copy link
Owner

Yeah, I think the table level filtering is a good catch-all for all scenarios someone might have when they really want to go for custom filtering. We can revisit later to add more convenience wrappers around it if it makes sense.

In my experience dealing with a collection of filters is a pain

Also my experience!

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.

None yet

2 participants