Welcome to the LimeSurvey Community Forum

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

Table with header on top and bottom

  • Fabian44
  • Fabian44's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 11 months ago #198244 by Fabian44
Table with header on top and bottom was created by Fabian44
Hey, guys one questions. I would like to repeat the header of a matrix table on the bottom as well. So that the same header is on top and bottom. Is that possible in an easy way?

thanks
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago #198249 by tpartner
Replied by tpartner on topic Table with header on top and bottom
Add this script to the question text:

Code:
<script type="text/javascript" charset="utf-8">
 
  $(document).on('ready pjax:scriptcomplete',function(){
 
    $('#question{QID} table.subquestion-list').append($('#question{QID} table.subquestion-list thead').clone());
 
  });
</script>



Sample survey attached:

File Attachment:

File Name: limesurvey...4-29.lss
File Size:36 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Fabian44
  • Fabian44's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 11 months ago #198650 by Fabian44
Replied by Fabian44 on topic Table with header on top and bottom
Thank you very much! Your solution works as described!

Unfortunately I recognised another problem, as it can be seen in the attachment. In the header in the bottom, I would like to have the number first (for example: 1) and below the number the text (for example: Disagree completely). Is it possible to do so? For example by adding specific text for every column in the bottom.

Thanks for you help!
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago #198698 by tpartner
Replied by tpartner on topic Table with header on top and bottom
Can you attach an export of a sample survey (.lss file) containing only that question?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Fabian44
  • Fabian44's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 11 months ago #198724 by Fabian44
Replied by Fabian44 on topic Table with header on top and bottom
Yeah, of yourse.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago #198737 by tpartner
Replied by tpartner on topic Table with header on top and bottom
1) Remove the <p> elements from your answers and use <br> tags for line breaks.

2) Insert this script in the question source:

Code:
<script type="text/javascript" charset="utf-8">
 
  $(document).on('ready pjax:scriptcomplete',function(){
 
    $('#question{QID} table.subquestion-list').append($('#question{QID} table.subquestion-list thead').clone());
 
    $('#question{QID} table.subquestion-list thead:last th').each(function(i) {
      var thisHTML = $(this).html();
      if(thisHTML.indexOf('<br>') >= 0) {
        var aThisHTML = $(this).html().split('<br>');
        $(this).html(aThisHTML[1]+'<br>'+aThisHTML[0]);
      }
    });
 
    $('#question{QID} table.subquestion-list thead:last th').css('vertical-align', 'top');
 
  });
</script>



Sample survey attached:

File Attachment:

File Name: limesurvey...7891.lss
File Size:21 KB

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
3 years 11 months ago #198749 by DenisChenu
Replied by DenisChenu on topic Table with header on top and bottom
Can't we use some css class ?

For example

HTML
Code:
1 <span class="notinhead">disagree</span>

and css :
thead .notinhead{display:none]

If i don't make error , the seond header lien was in tbody ?

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.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago #198758 by tpartner
Replied by tpartner on topic Table with header on top and bottom
Sure, but my thinking is that since we're already using JS to insert the bottom row, there is no need to bother with extra HTML and CSS.

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: DenisChenu
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose