Welcome, Guest
Username: Password: Remember me

TOPIC: Theming individual columns in array type question

Theming individual columns in array type question 8 months 2 weeks ago #102521

  • firzen
  • firzen's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 9
  • Karma: 0
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:
The administrator has disabled public write access.

Theming individual columns in array type question 8 months 2 weeks ago #102524

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4134
  • Thank you received: 765
  • Karma: 347
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Last Edit: 8 months 2 weeks ago by tpartner.
The administrator has disabled public write access.

Theming individual columns in array type question 8 months 2 weeks ago #102525

  • firzen
  • firzen's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 9
  • Karma: 0
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:
The administrator has disabled public write access.

Theming individual columns in array type question 8 months 2 weeks ago #102526

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4134
  • Thank you received: 765
  • Karma: 347
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Theming individual columns in array type question 8 months 2 weeks ago #102527

  • firzen
  • firzen's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 9
  • Karma: 0
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
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.143 seconds
Donation Image