- Posts: 43
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
public survey order
- marcomarenco
- Topic Author
- Offline
- Senior Member
Less
More
6 years 11 months ago #153122
by marcomarenco
public survey order was created by marcomarenco
Hi,
is it possible to order alphabetically (by name), the public surveys?
is it possible to order alphabetically (by name), the public surveys?
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10103
- Thank you received: 3591
6 years 11 months ago #153196
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic public survey order
In Configuration-->Global settings-->General, assign a custom template for "Default template:".
In that template, add this to the end of template.js:
In that template, add this to the end of template.js:
Code:
$(document).ready(function(){ if($('div.survey-list').length > 0) { // Create an array of survey titles var surveyTitles = []; $('div.survey-list a.surveytitle').each(function(i) { $(this).attr('data-sid', $(this).attr('href').split('index.php/')[1].split('?')[0]); $(this).attr('data-name', $.trim($(this).text())+' - '+$(this).attr('href').split('index.php/')[1].split('?')[0]); surveyTitles.push($(this).attr('data-name')); }); // Sort the titles surveyTitles.sort(); // Insert the survey links in sorted order $(surveyTitles).each(function(i, val) { var thisLink = $('div.survey-list a.surveytitle').filter(function(e) { return $(this).attr('data-name') == val; }); $('div.survey-list > .container > .row').append($(thisLink).parent()); }); // Handle the public stats links $('div.survey-list a.view-stats').each(function(i) { $(this).attr('data-sid', $(this).attr('href').split('statistics_user/')[1].split('?')[0]); $(this).parent().insertAfter($('div.survey-list a.surveytitle[data-sid="'+$(this).attr('data-sid')+'"]').parent()); }); // Fix up the dividers $('div.survey-list > .container > .row > .col-xs-12, div.survey-list > .container > .row > .col-xs-2').removeClass('vertical-divider right'); var dividerClass = 1; $('div.survey-list > .container > .row > .col-xs-12, div.survey-list > .container > .row > .col-xs-2').each(function(i) { dividerClass++; if(dividerClass % 2 == 0) { $(this).addClass('vertical-divider right'); } }); } });
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- marcomarenco
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 43
- Thank you received: 0
6 years 11 months ago #153375
by marcomarenco
Replied by marcomarenco on topic public survey order
Hi Tony,
thanks, i'm working on it, i'll give you a feedback soon
bye,
Marco
thanks, i'm working on it, i'll give you a feedback soon
bye,
Marco
The topic has been locked.