Check out the LimeSurvey source code on GitHub!

Theming individual columns in array type question

More
3 years 1 month ago #102521 by firzen
The request is to include two side options that are not apart of a scale but are still within the selection so 1-5 and then not applicable plus another option. So I'm looking for a way to change the colour of the last two columns so it looks seperate to the scale somewhat. The attached file is what it should look like. That was just with a dual scale though.
Attachments:

Please Log in to join the conversation.

More
3 years 1 month ago - 3 years 1 month ago #102524 by tpartner
Well, there are column-specific classes on the answer cells but not on the header row cells.

Add the following script to the question source. It will add column-specific classes to all cells in the array.
<script type="text/javascript" charset="utf-8">	
 
	$(document).ready(function(){
 
		// Identify this question
		var thisQuestionID = {QID}; // This question ID
		var thisQuestion = $('#question'+thisQuestionID); // This question
 
		// Add some column-specific classes
		$('thead tr, tr.subquestion-list', thisQuestion).each(function(i){
			$('> *', this).each(function(i){
				$(this).addClass('col-'+i+'');
			});
		});
	});
</script>


Then you can add something like this to the end of template.css (where 12345 is the question ID ).
#question12345 td.col-6,
#question12345 th.col-6,
#question12345 td.col-7,
#question12345 th.col-7 {
	background: #F5F5F5; 
}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last Edit: 3 years 1 month ago by tpartner.

Please Log in to join the conversation.

More
3 years 1 month ago #102525 by firzen
Sweet thanks that works great for changing the headers. How do i go about theming column-specifc classes on the answer cells? Just need it to look like this image i just attached.

What would be the best way to accomplish this? Could styling two of the columns separately and have the end-result looking like a unified block work or is there a better way. I'm pretty new with this stuff so sorry about all the questions.
Attachments:

Please Log in to join the conversation.

More
3 years 1 month ago #102526 by tpartner
Can you activate a test survey for me to see?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
3 years 1 month ago #102527 by firzen
it's all good i figured it out. thanks for the help. just had to add tbody tr to the function and it applied the rest of the column

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form