Advertisement
RyanFarley

Set Date Only Lookup Columns

Jun 20th, 2018
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.81 KB | None | 0 0
  1. var lookupId = "lookupInvoice";
  2. var dateOnlyFieldIndexes = "1,3"; // this is the indexes of the date column(s) in the lookup
  3.  
  4. ScriptManager.RegisterStartupScript(this, GetType(), "script_CustomizeInvoiceLookup", @"
  5.    require(['dojo/aspect', 'Sage/UI/SDataLookup'], function(aspect, SDataLookup) {
  6.        aspect.after(SDataLookup.prototype, '_formatStructure', function() {
  7.            if (this.id.indexOf('%LOOKUP%') !== -1)) {
  8.                var colIndexes = '%INDEXES%'.split(',');
  9.                for(var i = 0; i < colIndexes.length; i++) {
  10.                    var col = this.structure[parseInt(colIndexes[i].trim())+1];
  11.                    if (col) col.dateOnly = true;
  12.                }
  13.            }
  14.        });
  15.    });    
  16. ".Replace("%LOOKUP%", lookupId).Replace("%INDEXES%", dateOnlyFieldIndexes), true);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement