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

More
6 months 1 week ago #155363 by zschaerer
zschaerer created the topic: Changing background colour of rows in array / Suppressing the grouping of rows
I have created a customised array question with sliders and yes/no buttons by using this great workaround: www.limesurvey.org/forum/design-issues/1...s-no-question#155360

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
Attachments:

Please Log in to join the conversation.

More
6 months 1 week ago #155381 by tpartner
tpartner replied the topic: Changing background colour of rows in array / Suppressing the grouping of rows
Regarding the background colours, see "Fix up the row background colours" in the script I just posted in your other thread - www.limesurvey.org/forum/design-issues/1...tion?start=15#155380

<script type="text/javascript" charset="utf-8">
	$(document).ready(function(){	
 
		// 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) {
				$(this).addClass('array1');
			}
			else {
				$(this).addClass('array2');
			}
		});
	});
</script>

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


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

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!