Skip to content

Commit 830d29c

Browse files
committed
Allow opting out of applying Editor's LeftJoins.
1 parent 94d58bd commit 830d29c

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

DataTables-Editor-Server/SearchBuilderOptions.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public class SearchBuilderOptions
2323
private Action<Query> _where;
2424
private string _order;
2525
private List<LeftJoin> _leftJoin = new List<LeftJoin>();
26+
private bool _applyEditorLeftJoins = true;
2627
private Dictionary<string, string> _fromEnum = new Dictionary<string, string>();
2728

2829
/// <summary>
@@ -180,6 +181,18 @@ public SearchBuilderOptions LeftJoin(string table, string field1, string op, str
180181
return this;
181182
}
182183

184+
/// <summary>
185+
/// Choose not to apply the LeftJoins that were also applied to the wider Editor instance to the SearchBuilder select
186+
/// </summary>
187+
/// <param name="applyEditorLeftJoins">Apply global LeftJoins.</param>
188+
/// <returns>Self for chaining</returns>
189+
public SearchBuilderOptions OptOutEditorLeftJoins()
190+
{
191+
_applyEditorLeftJoins = false;
192+
193+
return this;
194+
}
195+
183196
/// <summary>
184197
/// Set an enum that will be used to apply items to the SearchBuilder select
185198
/// </summary>
@@ -237,7 +250,7 @@ internal List<Dictionary<string, object>> Exec(Field fieldIn, Editor editor, Lis
237250
return str;
238251
});
239252

240-
if(leftJoinIn.Count() > 0){
253+
if(leftJoinIn.Count() > 0 && _applyEditorLeftJoins){
241254
this._leftJoin = leftJoinIn;
242255
}
243256

0 commit comments

Comments
 (0)