项目-任务关联场景下分层查询过滤的实现方案咨询
Absolutely, this is totally doable! You already have the project-level filter set up to show only projects with incomplete tasks, so adding the task category filter for the detail panel is straightforward. Here's your step-by-step guide:
Step 1: Locate the Tasks Data Source for the Collapse Panel Detail
Head over to the configuration of your collapse panel's detail section—this is where the list of Tasks is bound to display when a project is expanded. Find the data query that pulls in the Tasks associated with the selected Project.
Step 2: Add the Category Filter to the Tasks Query
You'll need to modify this query to include a filter for the Task's Category field. Depending on whether you're using a visual filter builder or writing code directly, here are both approaches:
Option A: Visual Filter Builder (No Code)
- Add a new filter rule to the Tasks query:
- Field:
Category - Operator:
Is In(orBelongs To, depending on your platform's terminology) - Values:
Marketing,Sales
- Field:
Option B: Code-Based Filter
If you're working with a code-driven query (like the example you shared for the project filter), update the filter logic like this:
// Keep any existing filters (like the association to the selected Project) // Add the category filter query.filters.Category._in = ["Marketing", "Sales"];
Pro Tip (Optional)
If you want to ensure the detail list only shows incomplete tasks of those categories (aligning with the project-level filter), you can keep the Completed filter alongside the category rule:
query.filters.Completed._equals = false; query.filters.Category._in = ["Marketing", "Sales"];
That's it! Once you save these changes, the collapse panel's detail list will only display tasks that belong to either the "Marketing" or "Sales" category for each qualifying project.
内容的提问来源于stack exchange,提问作者user2041458

