Tuesday, April 06, 2010

Alternative to Alternating Row Colors in an Interactive Report

Almost a year ago I blogged about a solution how to create those nice striping in an Interactive Report. That solution is based on using the onLoad method of an image that you use in the IR for linking to a Form. The downside of that solution is that it doesn't 'support' sorting and filtering. After applying a sort of a filter the coloring is all gone. Also - in some browsers - the order in which the rows (or images) are loaded is not the same order as you see on the screen, resulting in a more or less randomized striping...

But recently I found out about the l_LastFunction attribute of a report. That function is called after all worksheet (report) AJAX calls. So if we define a function that does the striping for just the odd rows in the worksheet after all calls - like sorting, filtering - are done, the striping just keeps working!

The code uses jQuery and is just this:
  function altColor(){
   $(".apexir_WORKSHEET_DATA tr:odd").addClass("Odd");
      gReport.l_LastFunction = function(){altColor();}
  gReport = new apex.worksheet.ws("");
It works in Firefox, Safari and Chrome, not sure about IE though...
And of course there is a demo...
Post a Comment