Advertisement
RyanFarley

Change Lookup Default Search Field and Operator

Jan 10th, 2018
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.90 KB | None | 0 0
  1. var lookupId = lueContact.ClientID;
  2. var defaultField = "Email";
  3. var defaultOperator = "gt";
  4.  
  5. ScriptManager.RegisterStartupScript(this, GetType(), "script_CustomizeLookup", @"
  6. require(['dojo/aspect', 'Sage/UI/SearchConditionWidget'], function(aspect, SearchConditionWidget) {
  7.     aspect.after(SearchConditionWidget.prototype, '_setToDefaultOperator', function() {
  8.         var lookupId = '%LOOKUP%';
  9.         if (this.id.toLowerCase().substring(0, lookupId.length) == lookupId.toLowerCase()) {
  10.             this._operatorSelect.set('value', '%OP%');
  11.         }
  12.     });
  13.     aspect.after(SearchConditionWidget.prototype, '_setToDefaultField', function() {
  14.         var lookupId = '%LOOKUP%';
  15.         if (this.id.toLowerCase().substring(0, lookupId.length) == lookupId.toLowerCase()) {
  16.             this._fieldNameSelect.set('value', '%FIELD%');
  17.         }
  18.     });
  19. });
  20. ".Replace("%LOOKUP%", lookupId).Replace("%FIELD%", defaultField).Replace("%OP%", defaultOperator), true);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement