diff --git a/application/helpers/expressions/em_manager_helper.php b/application/helpers/expressions/em_manager_helper.php index 86424374f68..b0c49b3448c 100644 --- a/application/helpers/expressions/em_manager_helper.php +++ b/application/helpers/expressions/em_manager_helper.php @@ -6727,10 +6727,13 @@ static function GetRelevanceAndTailoringJavaScript() { $rowdividList[$sq['rowdivid']] = $sq['result']; - // make sure to update array_filter headings + // make sure to update array_filter headings and colors if( ! empty($LEM->qattr[$arg['qid']]['array_filter'])) { + // js to fix colors + $relParts[] = "updateColors($('#question".$arg['qid']."').find('table.question'));\n"; + // js to fix headings $repeatheadings = Yii::app()->getConfig("repeatheadings"); - if( ! empty($LEM->qattr[$arg['qid']]['repeat_headings'])) { + if(isset($LEM->qattr[$arg['qid']]['repeat_headings']) && $LEM->qattr[$arg['qid']]['repeat_headings'] !== "") { $repeatheadings = $LEM->qattr[$arg['qid']]['repeat_headings']; } if($repeatheadings > 0) diff --git a/scripts/expressions/em_javascript.js b/scripts/expressions/em_javascript.js index e99b4e20fb8..7fe81b3eed3 100644 --- a/scripts/expressions/em_javascript.js +++ b/scripts/expressions/em_javascript.js @@ -2917,7 +2917,7 @@ function time () { return Math.floor(new Date().getTime() / 1000); } -// updates the deadings of a dynamic table +// updates the repeated headings in a dynamic table function updateHeadings(tab, rep) { tab.find('.repeat').remove(); @@ -2925,8 +2925,6 @@ function updateHeadings(tab, rep) var trs = tab.find('tr:visible'); trs.each(function(i, tr) { - // fix line colors - $(tr).removeClass('array1').removeClass('array2').addClass('array' + (1 + i % 2)); // add heading but not for the first and the last rows if(i != 0 && i % rep == 0 && i != trs.length-1) { @@ -2934,3 +2932,14 @@ function updateHeadings(tab, rep) } }); } + +// updates the colors in a dynamic table +function updateColors(tab) +{ + var trs = tab.find('tr:visible'); + trs.each(function(i, tr) + { + // fix line colors + $(tr).removeClass('array1').removeClass('array2').addClass('array' + (1 + i % 2)); + }); +}