Welcome to the LimeSurvey Community Forum

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

Insert Blank column/row to seperate "no answer" choice

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 weeks 1 day ago #260075 by tpartner
Here is an updated script to handle that:

Code:
<script type="text/javascript" data-author="Tony Partner">
 
   $(document).on('ready pjax:scriptcomplete',function(){
 
        // Identify some elements
        var thisQuestion = $('#question{QID}');
        var thisTable = $('table.subquestion-list', thisQuestion);
 
        // Adjust column widths
        var spacerWidthPercent = 2;
        var labelWidth = ($('col:first', thisTable).width()/$('colgroup:first', thisTable).width())*100;
        var answerWidth = (100-labelWidth-spacerWidthPercent)/$('col:gt(0)', thisTable).length;
        $('col:gt(0)', thisTable).width(answerWidth+'%');
 
        // Insert some elements
        $('col:last', thisTable).before('<col class="inserted-spacer">');
        $('thead th:last-child, tr.ls-heading-repeat th:last-child', thisTable).before('<th class="inserted-spacer" />');
        $('tbody td.answer-item:last-child', thisTable).before('<td class="inserted-spacer" />');
 
    });
</script>

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.

  • BBSR-SR5
  • BBSR-SR5's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 weeks 1 day ago #260081 by BBSR-SR5
Thank you a lot, this works great!

In case some future limesurvey user wonders what changed. In the line:

$('thead th:last-child, tr.ls-heading-repeat th:last-child', thisTable).before('<th class="inserted-spacer" />');

the code ", tr.ls-heading-repeat th:last-child" got added.

Please Log in to join the conversation.

  • BBSR-SR5
  • BBSR-SR5's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 weeks 11 hours ago #260132 by BBSR-SR5
I've got another little design adjustment I want to do.

I want to color the radio buttons in the last/non-answer column grey.

I need to adjust the class radio-item label:before for this purpose. But I'm not sure how I make sure this is only applied to the last column.
Code:
.radio-item label::before {
border: 2px solid #6E748C;
background-color: #C6C6C6;
}

In the developer mode the class is attached to this:
 

I've been trying something like this:
Code:
$(document).on('ready pjax:scriptcomplete',function(){
 
    $('.array-flexible-row.inserted-spacer-question').each(function(e) {
 
        // Identify some elements
        var thisQuestion = $(this);
        var thisTable = $('table.subquestion-list', thisQuestion);
 
        // Adjust column widths
        var spacerWidthPercent = 4;
        var labelWidth = ($('col:first', thisTable).width()/$('colgroup:first', thisTable).width())*100;
        var answerWidth = (100-labelWidth-spacerWidthPercent)/$('col:gt(0)', thisTable).length;
        $('col:gt(0)', thisTable).width(answerWidth+'%');
 
        // Insert some elements
        $('col:last', thisTable).before('<col class="inserted-spacer">');
        $('thead th:last-child, tr.ls-heading-repeat th:last-child', thisTable).before('<th class="inserted-spacer" />');
        $('tbody td.answer-item:last-child', thisTable).before('<td class="inserted-spacer" />');
        //$('col:last', thisTable).addClass('radio-item-nr');
    });
 
});
I renamed the class to radio-item-nr, so it wouldn't overwrite the radio-item class elsewhere.

But this doesn't work. I assume that's because I'm trying to attach it at the wrong point?

 

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 weeks 11 hours ago #260134 by tpartner
Try this in custom.css:

Code:
.inserted-spacer-question .radio-item:last-child label::before {
    border-color: #CCCCCC;
    background-color: #FFFFFF;
}
 
.inserted-spacer-question .radio-item:last-child label::after {
    background-color: #CCCCCC;
}

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.

  • BBSR-SR5
  • BBSR-SR5's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
2 weeks 6 days ago - 2 weeks 6 days ago #260151 by BBSR-SR5
That doesn't seem to work. I've just put it in my custom.css and theme_blueberry.css, but it doesn't seem to affect the radio buttons of the last column.

Looking at the inspector the class also isn't overwritten, but doesn't seem to appear at all.


Never mind, it does work. Thank you very much. Apparently I looked at a question using an old template version.

Sorry for the confusion.
 
Last edit: 2 weeks 6 days ago by BBSR-SR5. Reason: Screen-to-keyboard-interface-error

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose