Repeat Headers in Matrix Table | XM Community
Skip to main content

Hello,
I'm looking to repeat my headers at various intervals within my long Matrix Table. I have seen a Javascript code circling around - but unsure of how to use it, and was hoping to get some help!
For example after question 3, 7, 10, etc. based on how the questions are "grouped" together.

Are you looking at something other than the builtin one's: https://www.qualtrics.com/support/survey-platform/survey-module/editing-questions/question-types-guide/standard-content/matrix-table/


Yes - when I add the current functionality in, it doesn't allow to change where the headers are repeated within the survey. I wanted the headers to repeat after/before certain questions and it doesn't allow me to do this. Do you know of anyway this can be done?


Its possible via JS, see if this works for you:
Qualtrics.SurveyEngine.addOnReady(function()
{
    choice_table = this.getChoiceContainer();
    //Numbering starts from 0. So the header is the 0th row, the first statement row 1 etc. 
    //This will create an empty row above statement 4. YOu can change it accordingly. 
    new_row = choice_table.insertRow(4);
    
    //rows=0] refersto the header. 
    // So this takes the header row fills up the empty row just created. 
    new_row.innerHTML = choice_table.rowsp0].innerHTML;
});
The code given above, works based on position. So, if you are randomizing you're statements, you will have to figure out where you need to insert your new row. Also, each group is a row, so take that also into account.


ahmedA Thank you so much!! This worked and was a lifesaver!
Thank you so much!!


Leave a Reply