- Posts: 10113
- Thank you received: 3595
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
- Offline
- LimeSurvey Community Team
Less
More
3 weeks 1 day ago #260075
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 Insert Blank column/row to seperate "no answer" choice
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
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 54
- Thank you received: 3
3 weeks 1 day ago #260081
by BBSR-SR5
Replied by BBSR-SR5 on topic Insert Blank column/row to seperate "no answer" choice
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.
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
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 54
- Thank you received: 3
3 weeks 11 hours ago #260132
by BBSR-SR5
Replied by BBSR-SR5 on topic Insert Blank column/row to seperate "no answer" choice
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.
In the developer mode the class is attached to this:
I've been trying something like this:
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?
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'); }); });
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10113
- Thank you received: 3595
3 weeks 11 hours ago #260134
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 Insert Blank column/row to seperate "no answer" choice
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
- Topic Author
- Offline
- Senior Member
Less
More
- Posts: 54
- Thank you received: 3
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.
Replied by BBSR-SR5 on topic Insert Blank column/row to seperate "no answer" choice
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.