Ranking question type does not show drag and drop

More
3 months 1 week ago #162471 by LouisGac
LouisGac replied the topic: Ranking question type does not show drag and drop
Tony: that's for LS3, he's using 2.70

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

More
3 months 1 week ago #162472 by tpartner
tpartner replied the topic: Ranking question type does not show drag and drop
That's what I see in the source.

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

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

More
3 months 1 week ago #162474 by tpartner
tpartner replied the topic: Ranking question type does not show drag and drop

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:

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

More
3 months 1 week ago #162493 by Heinrich
Heinrich replied the topic: Ranking question type does not show drag and drop
Thank you! Using the code of tpartner, it works!

Do I now always have to implement that source code or is there any other suggestion how to fix this?

Thanks.

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

More
3 months 1 week ago #162499 by tpartner
tpartner replied the topic: Ranking question type does not show drag and drop
Try adding this to the end of template.js - it should target all ranking questions.

$(document).ready(function() {
	var lang = $('body').attr('class').split(' lang-')[1].split(' ')[0];
 
	// The ranking interface text strings - Add/edit as required
	rankingTranslations = {          
		en: {          
			choice: 'Your choices',          
			rank: 'Your ranking',          
			help: 'Double-click or drag-and-drop items in the left list to move them to the right - your highest ranking item should be on the top right, moving through to your lowest ranking item.'         
		},          
		de: {          
			choice: 'Ihre Auswahl',          
			rank: 'Ihre Rangfolge',          
			help: 'Ordnen Sie die Elemente in die rechte Liste ein (höchste Bewertung oben). Die Elemente können mit der Maus verschoben werden. Doppelklick verschiebt ein Element in die andere Liste.'         
		}         
	};	
 
	aRankingTranslations = {          
		choicetitle: rankingTranslations[lang]['choice'],          
		ranktitle: rankingTranslations[lang]['rank'],          
		rankhelp: rankingTranslations[lang]['help']         
	};
 
	// Loop through all ranking questions	
	$('.question-container.ranking').each(function(e) {
		// Apply the drag-drop ranking interface
		var thisQID = $(thisQuestion).attr('id').replace(/question/, '');
		doDragDropRank(thisQID, 1,1,1);
	});
});

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

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

More
3 months 1 week ago #162501 by Heinrich
Heinrich replied the topic: Ranking question type does not show drag and drop
Thank you. Unfortunately it does not work. I edited the template.js, have chosen the template and removed the code in the question. No luck. Any suggestions about that?
Thanks!

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

More
3 months 1 week ago #162505 by tpartner
tpartner replied the topic: Ranking question type does not show drag and drop
Can you activate that test survey again?

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

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

More
3 months 1 week ago #162525 by Heinrich
Heinrich replied the topic: Ranking question type does not show drag and drop
Yes, sure, thanks. I´ve sent you a private message.

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

More
3 months 1 week ago #162535 by tpartner
tpartner replied the topic: Ranking question type does not show drag and drop
Oops, found a bug.

Try this:

$(document).ready(function() {
	var lang = $('body').attr('class').split(' lang-')[1].split(' ')[0];
 
	// The ranking interface text strings - Add/edit as required
	rankingTranslations = {          
		en: {          
			choice: 'Your choices',          
			rank: 'Your ranking',          
			help: 'Double-click or drag-and-drop items in the left list to move them to the right - your highest ranking item should be on the top right, moving through to your lowest ranking item.'         
		},          
		de: {          
			choice: 'Ihre Auswahl',          
			rank: 'Ihre Rangfolge',          
			help: 'Ordnen Sie die Elemente in die rechte Liste ein (höchste Bewertung oben). Die Elemente können mit der Maus verschoben werden. Doppelklick verschiebt ein Element in die andere Liste.'         
		}         
	};	
 
	aRankingTranslations = {          
		choicetitle: rankingTranslations[lang]['choice'],          
		ranktitle: rankingTranslations[lang]['rank'],          
		rankhelp: rankingTranslations[lang]['help']         
	};
 
	// Loop through all ranking questions	
	$('.question-container.ranking').each(function(e) {
		// Apply the drag-drop ranking interface
		var thisQID = $(this).attr('id').replace(/question/, '');
		doDragDropRank(thisQID, 1,1,1);
	});
});

Cheers,
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: Heinrich

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

More
3 months 1 week ago #162540 by Heinrich
Heinrich replied the topic: Ranking question type does not show drag and drop
This looks great! Thank you so much!! I really appreciate your help.

Any idea why this did not work for me but for all others?

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

More
3 months 1 week ago #162542 by tpartner
tpartner replied the topic: Ranking question type does not show drag and drop
Sorry, no, I have no clue why the built-in call for the function is not working.

I can see it in the source but, obviously, it wasn't fired for some reason.

All we did here is add another call for the same function in a different position on the DOM flow.

It's a mystery to me...

Cheers,
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: Heinrich

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

More
3 months 1 week ago #162552 by Heinrich
Heinrich replied the topic: Ranking question type does not show drag and drop
Still, it's great that it's working now. Thank you so much! :)

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!