0

I am trying to automatically add a table to a report after the end of the loading process. I tried that using the jQuery .append() Method on the report (context.$report):

function consumeEvent( context, event ) {                                
    if (event.name == 'ic3-report-after-build') {
        context.$report.append( "<table>...</table>" );
    }                                                                       
}

Unfortunately nothing happens. What am I doing wrong?

Erik Philips
  • 53,428
  • 11
  • 128
  • 150
UlrichWuenstel
  • 460
  • 2
  • 10
  • Are you sure `context.$report` is a jQuery object? If so what does `console.log(context.$report.length);` output in your console? – War10ck Jul 18 '16 at 20:25
  • I hoped, that it is a jQuery object. context.$report.length shows 1. Here is a short description about this in icCube and I hoped, something like this could work... http://www.iccube.com/livedemo/?ic3reportName=Javascript%20Code – UlrichWuenstel Jul 19 '16 at 07:00

1 Answers1

1

You have correct code, but still it should be enhanced a bit.

Try this one:

Report JavaScript

function consumeEvent( context, event ) {                                
    if (event.name == 'ic3-report-after-build') {
        context.$report.find('table#custom').remove()
        context.$report.find('.ic3-report-content-container')
        .append('<table id="custom"><tr><td>Table</td></tr></table>')
    }                                                                       
}

Report CSS

table#custom {
    border: 1px solid #black;
    position: absolute;
    top: 0;
}
Artem Lopatiy
  • 948
  • 5
  • 15