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

[FEATURE] - Dynamic and exclusive list.filters #491

Open
lonelyion opened this issue Nov 29, 2024 · 0 comments
Open

[FEATURE] - Dynamic and exclusive list.filters #491

lonelyion opened this issue Nov 29, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@lonelyion
Copy link

lonelyion commented Nov 29, 2024

Summary

The list.filters now seems to be fixed by field and value. This is not quite flexible, so I suggest to add a group property to filter where only one filter can be applied in the group (like RadioButton group). And the fields can also accepts a function to dynamicly generate filters.

Basic Example

in model.posts.list

filters: async () => {
	return (await prisma.categories.findMany({ select: { id: true, name: true } })).map((item) => {
		return {
		  label: item.name,
		  active: false,
		  group: 'by_categories_id',
		  value: {
		    categories: {
		      id: item.id
		    }
		  }
		};
	});

Drawbacks

If the function is complex, the performance might be affected greatly

Unresolved questions

No response

@lonelyion lonelyion added the enhancement New feature or request label Nov 29, 2024
@foyarash foyarash self-assigned this Dec 6, 2024
@foyarash foyarash mentioned this issue Dec 6, 2024
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants