diff --git a/lib/outputcomponents.php b/lib/outputcomponents.php
index 1af6cf2..f91f7a7 100644
--- a/lib/outputcomponents.php
+++ b/lib/outputcomponents.php
@@ -1496,7 +1496,12 @@ class html_writer {
                         $row->attributes['class'] .= ' lastrow';
                     }
 
-                    $output .= html_writer::start_tag('tr', array('class' => trim($row->attributes['class']), 'style' => $row->style, 'id' => $row->id)) . "\n";
+                    $trattributes = array_merge($row->attributes, array(
+                        'class' => trim($row->attributes['class']),
+                        'id'    => $row->id,
+                        'style' => $row->style,
+                    ));
+                    $output .= html_writer::start_tag('tr', $trattributes) . "\n";
                     $keys2 = array_keys($row->cells);
                     $lastkey = end($keys2);
 
