diff --git a/DataTables-Editor-Server/SearchBuilderOptions.cs b/DataTables-Editor-Server/SearchBuilderOptions.cs index 959e123..c56d95e 100644 --- a/DataTables-Editor-Server/SearchBuilderOptions.cs +++ b/DataTables-Editor-Server/SearchBuilderOptions.cs @@ -23,6 +23,7 @@ public class SearchBuilderOptions private Action _where; private string _order; private List _leftJoin = new List(); + private bool _applyEditorLeftJoins = true; private Dictionary _fromEnum = new Dictionary(); /// @@ -180,6 +181,18 @@ public SearchBuilderOptions LeftJoin(string table, string field1, string op, str return this; } + /// + /// Choose not to apply the LeftJoins that were also applied to the wider Editor instance to the SearchBuilder select + /// + /// Apply global LeftJoins. + /// Self for chaining + public SearchBuilderOptions ApplyEditorLeftJoins(bool applyEditorLeftJoins = true) + { + _applyEditorLeftJoins = applyEditorLeftJoins; + + return this; + } + /// /// Set an enum that will be used to apply items to the SearchBuilder select /// @@ -237,7 +250,7 @@ internal List> Exec(Field fieldIn, Editor editor, Lis return str; }); - if(leftJoinIn.Count() > 0){ + if(leftJoinIn.Count() > 0 && _applyEditorLeftJoins){ this._leftJoin = leftJoinIn; }