DataTables / Editor-NET

.NET Framework and .NET Core server-side libraries for Editor
Other
15 stars 12 forks source link

SearchBuilderOptions()/SearchPaneOptions() include unrelated Left Joins #17

Open VictorioBerra opened 6 months ago

VictorioBerra commented 6 months ago

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