Changing background colour of rows in array / Suppressing the grouping of rows

1 year 9 months ago #155363 by zschaerer
I have created a customised array question with sliders and yes/no buttons by using this great workaround:

I extended it a bit because I wanted the labels of each slider to be randomly displayed on the left and right side of the slider (e.g. good - bad vs. bad - good). To achieve this, I created each question in two versions (one version labelled good - bad and one version labelled bad - good). A script then creates a random number 0 or 1 and depending on this number, one version of the question is hidden.

This now leads to the problem that the background colour of the rows is not alternating anymore because in some cases two rows with the same colour are displayed directly one after the other. How can I adjust that?

A second problem (has nothing to do with the workaround) is that if I have more than 5 questions, the rows are automatically grouped into groups of 5 and a quite large white frame is inserted between these groups. How can I switch that off?

See attached test survey.

File Attachment:

File Name: limesurvey...5-31.lss
File Size:30 KB

Please Log in or Create an account to join the conversation.

LimeSurvey Partners
1 year 9 months ago #155381 by tpartner
Regarding the background colours, see "Fix up the row background colours" in the script I just posted in your other thread -

<script type="text/javascript" charset="utf-8">
		// Fix up the row background colours
		var rowIndex = 0;
		$('table.subquestion-list tbody tr', thisQuestion).each(function(i){
			rowIndex ++;
			$(this).removeClass('array1, array2');
			if(rowIndex % 2 == 0) {
			else {

Regarding the row grouping, I suspect it is the "Repeating headings in array questions every X subquestions".

Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: zschaerer

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!