Browsing responses

More
5 years 4 months ago - 5 years 4 months ago #74535 by tpartner
tpartner replied the topic: Aw: Browsing responses

Can i somehow list survey id's in the code that tpartner made before so i get the same action to other surveys aswell?

You can wrap the code in a function and then call it with the survey IDs followed by the columns to hide (all comma-separated).

The following example will hide two columns for surveys 13829 and 12269 and hide 4 columns for survey 66653.
$(document).ready(function(){
 
	hideColumns(13829,3,5);
	hideColumns(12269,3,5);
	hideColumns(66653,3,5,6,9);
 
	function hideColumns() {
 
		var sID = arguments[0];
 
		if($('input[name="sid"]').attr('value') == sID) {
 
			// Add some column-specific classes
			$('.browsetable tr').each(function(i, el){
				$('> *', this).each(function(i, el){ 
					$(el).addClass('col-'+(i+1));
				});
			});
 
			// Create an array of columns to hide
			var hiddenColumns = new Array();
			$(arguments).each(function(i, arg){
				if(i > 0) {
					hiddenColumns.push(arg);
				}
			});
 
			// Loop through the hiddenColumns and hide them
			$(hiddenColumns).each(function(i){ 
				$('.col-'+this+'').hide();
			});
		}
	}
 
});

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last Edit: 5 years 4 months ago by tpartner.
The following user(s) said Thank You: tave

Please Log in to join the conversation.

More
5 years 4 months ago #74701 by tave
tave replied the topic: Browsing responses
Tpartner that is real magic thank you very much=) That works like a charm.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now