DataTables / DataTables/NET

SearchBuilderOptions()/SearchPaneOptions() include unrelated Left Joins

Open
#17 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
19
Forks
11
PR merge metrics
No merged PRs in 30d

Description

In the samples SearchBuilderController.cs adding addition joins show up in that search builder query:

      .Field(new Field("users.site")
          .Options(new Options()
              .Table("sites")
              .Value("id")
              .Label("name")
          )
      )
      .Field(new Field("sites.name")
          .SearchBuilderOptions(new SearchBuilderOptions()
              .Label("sites.name")
              .Value("sites.name")
              .LeftJoin("sites", "sites.id", "=", "users.site")
          )
      )
    .LeftJoin("sites", "sites.id", "=", "users.site")
    .LeftJoin("user_dept", "users.id", "=", "user_dept.user_id")
SELECT  sites.name as 'value', sites.name as 'label' 
FROM  users 
LEFT JOIN sites ON sites.id = users.site  
LEFT JOIN user_dept ON users.id = user_dept.user_id  
GROUP BY sites.name

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the SearchBuilderController.cs sample and trace how SearchBuilderOptions() and SearchPaneOptions() generate their queries and inherit joins. Compare the generated SQL with the joins declared for the field and the parent query. Done means unrelated LEFT JOIN clauses no longer appear in the search builder query.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend-api-design
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.