Adjusting Matrix Column Widths | XM Community
Skip to main content

I tried searching the community and not sure I saw a solution for this. I saw some workarounds, but not sure they would work in this instance. I'm also very new at this so sorry if this is a dumb question. I'm trying to make the columns more consistent in the matrix. I realize it's because my 1 and 10 have long text in them but this is pretty standard for our organization. I've shrunk the font down to an 8. I tried the "labels" that are native to the question type, but the right label extends over the N/A option, and that is inaccurate. Do I have other options here? Thanks for any feedback.
matrix columns.jpg

You can use labels and modify the colspan attribute with JS so the label doesn't extend over the NA.


Thank you. That sounds like exactly what I need to do. I see that the colspan is 11 by default, so I would want to change it to 10. I don't really know much about JavaScript, other than copy and paste code that I found. Do you know what that code would look like?


Do you know what that code would look like?

var cl = jQuery("#"+this.questionId+" td.ColumnLabels");
cl.attr('colspan',cl.attr('colspan')-1);
EDIT: typo corrected


Thanks for the prompt response. I tried this, and I didn't see any change. Maybe I input it wrong? I tried colspan-1 like you had and didn't see a change so I changed it to -4 just to see if the change was so minor I wasn't see it. Still no change. I tried it in addonload and addonready. When I preview the survey, I see that the ColumnLabels colspan is still set to 11. Did I implement incorrectly?

Qualtrics.SurveyEngine.addOnload(function()
{
var cl = jQuery("#"+this.questiondId+" td.ColumnLabels");
cl.attr('colspan',cl.attr('colspan')-4);
});


Incorrect spelling of this.questionId
Try changing to:
var cl = jQuery("#"+this.questionId+" td.ColumnLabels");
cl.attr('colspan',cl.attr('colspan')-4);


that did it. Thanks so much. I should have caught that. Thank you both


https://www.qualtrics.com/community/discussion/comment/25001#Comment_25001This didn't work for my matrix question.


Leave a Reply