ordering surveys

More
2 years 9 months ago #117459 by reducto
reducto created the topic: ordering surveys
hi,

i was just wondering whether i can arrange or re-order the surveys in the homepage. i named the surveys as the following: 1, 2, 3... however, the order is just 2, 3, 1...

is there anyway I can do this without any pain?

Please Log in to join the conversation.

More
2 years 9 months ago #117498 by tpartner
tpartner replied the topic: ordering surveys
I'm not sure what the thinking was for the list sorting but adding something like this to the end of template.js should sort the list alphabetically.

$(document).ready(function() {
 
	if($('a.surveytitle').length > 0) {
		var surveyList = $('a.surveytitle:eq(0)').closest('ul');
		var titlesArr = [];
		$('a.surveytitle').each(function(i) {
			titlesArr.push($.trim($(this).text()));
		});
		titlesArr.sort();
		$(titlesArr).each(function(i) {
			var thisText = this;
			$('a.surveytitle').filter(function() {
				return $.trim($(this).text()) == thisText;
			}).closest('li').appendTo(surveyList);
		});
	}
});

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
2 years 9 months ago #117520 by DenisChenu
DenisChenu replied the topic: ordering surveys
Not sure it work, but can try:

<!-- 01 -->B survey
<!-- 02 -->A survey
<!-- 03 -->A2 survey

For each title : adding an HTML comment

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!