Adjust Height of Matrix Table (fixed height w/ OverflowY) | XM Community
Skip to main content

Ok so I am new to development on Qualtrics although I have been using it for some time. Not new to JS/HTML/CSS but the below code is pretty wonky I know - trying to get this right for a reach goal of a supervisor!

 

My question is this: Why is my height not applying? I was able to test that I am actually adjusting the CSS related to the Matrix table I am attempting to work with by changing the background-color which I was able to do. In fact I can adjust other CSS properties, but not the height. Why is this? I realize my way of reaching the Matrix table “tbody” was a bit obnoxious but it’s 5am and I’m trying to “go the extra mile” in a short time.

Qualtrics.SurveyEngine.addOnload(function()
{
    matrix = this.questionContainer.childNodesa5].childNodese1].childNodese1].childNodese2].childNodese1].childNodese5]
    matrix.style.height = "200px";
    matrix.setAttribute("id","matrixID")

});

Qualtrics.SurveyEngine.addOnReady(function()
{
    matrix = this.questionContainer.childNodess5].childNodes.1].childNodes.1].childNodes.2].childNodes.1].childNodes.5]
    matrix.style.height = "200px";

});

Qualtrics.SurveyEngine.addOnUnload(function()
{
    matrix = this.questionContainer.childNodesi5].childNodest1].childNodesd1].childNodesd2].childNodesd1].childNodesd5]
    matrix.style.height = "200px";

});

 

After setting the Id I was also able to confirm I can adjust some CSS properties (like background-color), but again not height while using the Qualtrics “Look and Feel” tab and editing the CSS there.

 

Obviously I am doing something blatantly wrong (besides how I am reaching the tbody of the Matrix table), but what? My organization has preset themes, could those prevent me from adjusting height?

Preset themes could be the issue here. I would test this in a survey, where you chose a different custom theme, or change the theme in the current survey if you can.

The code is for sure not needed in the addOnUnload function (I see your desperation here :))

I would think that it should be enough to have it in the addOnReady but test with both first - It can’t hurt ;)


Thank you very much for your answer - I appreciate it!

Also, I hadn’t realized there was such an obvious way to test this as reverting the survey back to a blank theme.

Thanks again!

 


Leave a Reply