Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion DataTables-Editor-Server/SearchBuilderOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class SearchBuilderOptions
private Action<Query> _where;
private string _order;
private List<LeftJoin> _leftJoin = new List<LeftJoin>();
private bool _applyEditorLeftJoins = true;
private Dictionary<string, string> _fromEnum = new Dictionary<string, string>();

/// <summary>
Expand Down Expand Up @@ -180,6 +181,18 @@ public SearchBuilderOptions LeftJoin(string table, string field1, string op, str
return this;
}

/// <summary>
/// Choose not to apply the LeftJoins that were also applied to the wider Editor instance to the SearchBuilder select
/// </summary>
/// <param name="applyEditorLeftJoins">Apply global LeftJoins.</param>
/// <returns>Self for chaining</returns>
public SearchBuilderOptions ApplyEditorLeftJoins(bool applyEditorLeftJoins = true)
{
_applyEditorLeftJoins = applyEditorLeftJoins;

return this;
}

/// <summary>
/// Set an enum that will be used to apply items to the SearchBuilder select
/// </summary>
Expand Down Expand Up @@ -237,7 +250,7 @@ internal List<Dictionary<string, object>> Exec(Field fieldIn, Editor editor, Lis
return str;
});

if(leftJoinIn.Count() > 0){
if(leftJoinIn.Count() > 0 && _applyEditorLeftJoins){
this._leftJoin = leftJoinIn;
}

Expand Down