- Posts: 102
- Thank you received: 2
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Manually changing widths of dual array columns
- boshra.m
- Topic Author
- Offline
- Premium Member
Less
More
1 year 3 months ago #239217
by boshra.m
Manually changing widths of dual array columns was created by boshra.m
Please help us help you and fill where relevant:
Your LimeSurvey version: LimeSurvey Cloud Version 5.4.12
Own server or LimeSurvey hosting: LimeSurvey hosting
Survey theme/template: Fruity
==================
Hello again,
I am trying to modify the widths of the columns for a dual array question so that my text fits without having to reduce the size of the text. I looked through a bunch of forums to try and find the answer and attempted the below from these forums
forums.limesurvey.org/forum/design-issue...xt-questions?start=0
forums.limesurvey.org/forum/can-i-do-thi...rvey?start=15#186378
forums.limesurvey.org/forum/can-i-do-thi...in-limesurvey#183356
In my question source
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:scriptcomplete',function(){
// Identify this question
var thisQuestion = $('#question{QID}');
// Add a question class
thisQuestion.addClass('custom-dualarray');
// Column-specific classes
$('table.subquestion-list tr', thisQuestion).each(function(i) {
$('th, td', this).each(function(i) {
$(this).addClass('column-'+i);
});
});
});
});
</script>
In my .css
<style type="text/css">
.custom-dualarray table.subquestion-list col {
width: auto !important;
}
.custom-dualarray table.subquestion-list thead td,
.custom-dualarray table.subquestion-list thead th {
}
.custom-dualarray table.subquestion-list thead .column-0 {
}
.custom-dualarray table.subquestion-list thead .column-1 { width: 40%; }
.custom-dualarray table.subquestion-list thead .column-2 { width: 10%; }
.custom-dualarray table.subquestion-list thead .column-3 { width: 6%; }
.custom-dualarray table.subquestion-list thead .column-4 { width: 5%; }
.custom-dualarray table.subquestion-list thead .column-5 { width: 2%; }
.custom-dualarray table.subquestion-list thead .column-6 { width: 7%; }
.custom-dualarray table.subquestion-list thead .column-7 { width: 1%; }
.custom-dualarray table.subquestion-list thead .column-8 { width: 10%; }
.custom-dualarray table.subquestion-list thead .column-9 { width: 6%; }
.custom-dualarray table.subquestion-list thead .column-10 { width: 5%; }
.custom-dualarray table.subquestion-list thead .column-11 { width: 1%; }
.custom-dualarray table.subquestion-list thead .column-12 { width: 7%; }
</style>
It seems as though the column 1 width does work but the rest don't change.
I have also attached the iss file below.
Thank you very much!!
Your LimeSurvey version: LimeSurvey Cloud Version 5.4.12
Own server or LimeSurvey hosting: LimeSurvey hosting
Survey theme/template: Fruity
==================
Hello again,
I am trying to modify the widths of the columns for a dual array question so that my text fits without having to reduce the size of the text. I looked through a bunch of forums to try and find the answer and attempted the below from these forums
forums.limesurvey.org/forum/design-issue...xt-questions?start=0
forums.limesurvey.org/forum/can-i-do-thi...rvey?start=15#186378
forums.limesurvey.org/forum/can-i-do-thi...in-limesurvey#183356
In my question source
<script type="text/javascript" charset="utf-8">
$(document).on('ready pjax:scriptcomplete',function(){
// Identify this question
var thisQuestion = $('#question{QID}');
// Add a question class
thisQuestion.addClass('custom-dualarray');
// Column-specific classes
$('table.subquestion-list tr', thisQuestion).each(function(i) {
$('th, td', this).each(function(i) {
$(this).addClass('column-'+i);
});
});
});
});
</script>
In my .css
<style type="text/css">
.custom-dualarray table.subquestion-list col {
width: auto !important;
}
.custom-dualarray table.subquestion-list thead td,
.custom-dualarray table.subquestion-list thead th {
}
.custom-dualarray table.subquestion-list thead .column-0 {
}
.custom-dualarray table.subquestion-list thead .column-1 { width: 40%; }
.custom-dualarray table.subquestion-list thead .column-2 { width: 10%; }
.custom-dualarray table.subquestion-list thead .column-3 { width: 6%; }
.custom-dualarray table.subquestion-list thead .column-4 { width: 5%; }
.custom-dualarray table.subquestion-list thead .column-5 { width: 2%; }
.custom-dualarray table.subquestion-list thead .column-6 { width: 7%; }
.custom-dualarray table.subquestion-list thead .column-7 { width: 1%; }
.custom-dualarray table.subquestion-list thead .column-8 { width: 10%; }
.custom-dualarray table.subquestion-list thead .column-9 { width: 6%; }
.custom-dualarray table.subquestion-list thead .column-10 { width: 5%; }
.custom-dualarray table.subquestion-list thead .column-11 { width: 1%; }
.custom-dualarray table.subquestion-list thead .column-12 { width: 7%; }
</style>
It seems as though the column 1 width does work but the rest don't change.
I have also attached the iss file below.
Thank you very much!!
Please Log in to join the conversation.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
1 year 3 months ago #239219
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 Manually changing widths of dual array columns
If all you are worried about is widths, you should be able to do it with pure CSS in the question source:
Sample survey attached:
Code:
<style type="text/css" data-author="Tony Partner"> /* Sub-question text column */ #question{QID} col.col-answers { width: 40% !important} /* Scale 1 */ #question{QID} colgroup.group-1 col:nth-child(1) { width: 10% !important} #question{QID} colgroup.group-1 col:nth-child(2) { width: 6% !important} #question{QID} colgroup.group-1 col:nth-child(3) { width: 5% !important} #question{QID} colgroup.group-1 col:nth-child(4) { width: 2% !important} #question{QID} colgroup.group-1 col:nth-child(5) { width: 7% !important} /* Separator column */ #question{QID} col.separator { width: 1% !important} /* Scale 2 */ #question{QID} colgroup.group-2 col:nth-child(1) { width: 10% !important} #question{QID} colgroup.group-2 col:nth-child(2) { width: 6% !important} #question{QID} colgroup.group-2 col:nth-child(3) { width: 5% !important} #question{QID} colgroup.group-2 col:nth-child(4) { width: 1% !important} #question{QID} colgroup.group-2 col:nth-child(5) { width: 7% !important} </style>
Sample survey attached:
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.
- boshra.m
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 102
- Thank you received: 2
1 year 3 months ago #239227
by boshra.m
Replied by boshra.m on topic Manually changing widths of dual array columns
Awesome, thank you!
Please Log in to join the conversation.