Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

ordering surveys

  • reducto
  • reducto's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 1 month ago #117459 by reducto
ordering surveys was created by reducto
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?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 1 month ago #117498 by tpartner
Replied by tpartner on 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.

Code:
$(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.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 1 month ago #117520 by DenisChenu
Replied by DenisChenu on 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 , plugin development .
I don't answer to private message.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose