Welcome to the LimeSurvey Community Forum

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

Extra heading row for array

  • tixeon
  • tixeon's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 10 months ago #200655 by tixeon
Extra heading row for array was created by tixeon
I had the following script to add an extra row in array questions in the past, but it is no longer working with the current version (3.22.17, professional hosted).
Code:
<script type="text/javascript" charset="utf-8">  
    $(document).ready(function(){
    // Identify this question
    var thisQuestion = $('#question{QID}');
    // Insert the new header row
    $('table.subquestions-list thead', thisQuestion).prepend('<tr class="new-header">\
      <td>&amp;nbsp;</td>\
      <th colspan="6" style="text-align:left;">Not satisfied at all</th>\
      <th colspan="5" style="text-align:right;">Completely satisfied</th>\
      <th></th>\
    </tr>');
  });
</script>

Essentially it is so that I have an extra row that looks like this (red part):


Any thoughts on how I can get it to work on the latest version?
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 10 months ago #200659 by Joffm
Replied by Joffm on topic Extra heading row for array
Hi, tixeon,

but it is no longer working with the current version (3.22.17, professional hosted).


Here is a script that runs in 3.22.x
I used the script provided here
forums.limesurvey.org/forum/can-i-do-thi...ngs-with-subheadings
Code:
<script type="text/javascript" charset="utf-8">  
  $(document).on('ready pjax:scriptcomplete',function(){
    // Insert the column categories
    $('#question{QID} table.subquestion-list thead tr:eq(0) td:eq(0)').remove();
    $('#question{QID} table.subquestion-list thead').prepend('<tr class="ls-heading">\
      <td rowspan="2" colspan="1"></td>\
      <th colspan="6" style="text-align:left;">Not satisfied at all</th>\
      <th colspan="5" style="text-align:right;">Completely satisfied</th>\
      <td colspan="2"></td>\
    </tr>');
  });
</script>

You see there is only a small change in the first lines.




Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
The following user(s) said Thank You: tixeon
The topic has been locked.
  • tixeon
  • tixeon's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 10 months ago #200859 by tixeon
Replied by tixeon on topic Extra heading row for array
Brilliant, that works, thank you!
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose