Welcome to the LimeSurvey Community Forum

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

Array Table too Small

  • Winocll_48635
  • Winocll_48635's Avatar Topic Author
  • Offline
  • Banned
  • Banned
More
9 years 2 months ago #124607 by Winocll_48635
Array Table too Small was created by Winocll_48635
I've been learning quite a bit from the manual and discussion board. I have my design almost where it needs to be...but i am stumped by two things...
  • The array table comes out way too small
  • I need to get rid of the middle white line between the two headers in the array

Here's a pic of the problematic question:


Here's how the question code looks:

5. Overall, how would you rate your customer service experience? <script type="text/javascript" charset="utf-8">
$(document).ready(function(){

// ADD HEADER ROW
var thisQuestion = $('#question{QID}');

// Insert the new header row
$('table.subquestions-list thead', thisQuestion).prepend('<tr class="new-header">\
<td>&nbsp;</td>\
<th colspan="6" style="text-align:left;">Not at all important</th>\
<th colspan="5" style="text-align:right;">Extremely important</th>\
<th></th>\
</tr>');

// HIDE SUB-QUESTION
var thisQuestion = $('#question{QID}');

// Hide the sub-question column
$('.subquestions-list .col-responses .col-answers', thisQuestion).hide();
$('.subquestions-list thead td', thisQuestion).hide();
$('.subquestions-list .answertext', thisQuestion).hide();
});

</script>

The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 2 months ago #124697 by tpartner
Replied by tpartner on topic Array Table too Small
Try this:

Code:
<script type="text/javascript" charset="utf-8">    
  $(document).ready(function(){
 
    // IDENTIFY THIS QUESTION
    var thisQuestion = $('#question{QID}');
 
    // HIDE SUB-QUESTION
    $('.subquestions-list .col-answers', thisQuestion).remove();
    $('.subquestions-list thead td', thisQuestion).remove();
    $('.subquestions-list .answertext', thisQuestion).remove();
    $('.subquestions-list col', thisQuestion).attr('width', (100/$('.subquestions-list col', thisQuestion).length)+'%');
 
    // ADD HEADER ROW
    $('table.subquestions-list thead', thisQuestion).prepend('<tr class="new-header">\
    <th colspan="11" style="text-align:left;">Not at all important<span style="float:right">Extremely important</span></th>\
    <th></th>\
    </tr>');
  });
</script>

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Winocll_48635
  • Winocll_48635's Avatar Topic Author
  • Offline
  • Banned
  • Banned
More
9 years 2 months ago #124699 by Winocll_48635
Replied by Winocll_48635 on topic Array Table too Small
That worked perfectly to get rid of the white line! So it was the fact that i had two colspans instead of one...that should have been more obvious to me :side:
Thank you sooo much.

Is there a way to get the table bigger? When i do an array that has subquestions it is larger, but when i add the script it gets smaller.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 2 months ago #124700 by tpartner
Replied by tpartner on topic Array Table too Small
Can you activate a sample survey for us to see?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Winocll_48635
  • Winocll_48635's Avatar Topic Author
  • Offline
  • Banned
  • Banned
More
9 years 2 months ago #124712 by Winocll_48635
Replied by Winocll_48635 on topic Array Table too Small
Here's a test survey with just the two types of questions that this thread relates to...
somptech.com/rks/lime/index.php/567743?lang=en

In measuring the width of the scales it looks like the array question that has subquestions is 471 pixels wide while the array question that hides subquestions is 448 pixels wide.

But i would like to know how to enlarge (widen and heighten if necessary) the tables even if they were the same size in case that is needed on a particular survey.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 1 month ago #124717 by tpartner
Replied by tpartner on topic Array Table too Small
I would add something like this to the end of template.css (adjust the "100%" as you see fit):

Code:
table.subquestions-list {
    width: 100%;
}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Winocll_48635
  • Winocll_48635's Avatar Topic Author
  • Offline
  • Banned
  • Banned
More
9 years 1 month ago #124762 by Winocll_48635
Replied by Winocll_48635 on topic Array Table too Small
Tried it, but didn't work :(

I imagine since the problem is with array questions that hide the subquestions that changing the subquestion list width doesn't apply to this issue.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 1 month ago #124787 by tpartner
Replied by tpartner on topic Array Table too Small
Try:

Code:
div.answers table {
    width: 100%;
}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Winocll_48635
  • Winocll_48635's Avatar Topic Author
  • Offline
  • Banned
  • Banned
More
9 years 1 month ago #124795 by Winocll_48635
Replied by Winocll_48635 on topic Array Table too Small
That worked perfectly! Thank you so much.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose