Matrix headers for extremely long items | XM Community
Skip to main content
Hello, I have an extremely long Matrix item, and my client insist on it being on one screen.



It's so long that the repeat header option (which only displays 3 repetitions - top, middle, bottom) isn't enough to always have the item options on the screen. To fix this, is it possible to either:

* Freeze the column header options at the top of the screen while scrolling (preferred), or

* Add extra repeated headers?



Thanks for any help! -Matt
Repeat headers "All" repeats the headers on every row. You can then display every nth header by writing some JavaScript to hide extra headers.
Hello @MattyD ,



Check the 'All' option in the Repeat headers and then paste the below code in the js(onReady) of the matrix question.



var j=jQuery(".ChoiceRow:last").index()/2;

console.log(j);

var i;

jQuery('tbody tr.RepeatHeader').eq(0).hide();

for( i=1;i<=j;i++){

if(i % 5 != 0 ){jQuery('tbody tr.RepeatHeader').eq(i).hide();}

}



This will repeat headers after 5 statements. To repeat headers after n number of statement then replace 5 with the n number.
Where do you paste the script?
I paste the script here in the question as shown below. But it's not working for me. Thoughts?





Qualtrics.SurveyEngine.addOnload(function()

{

var j=jQuery(".ChoiceRow:last").index()/2;

console.log(j);

var i;

jQuery('tbody tr.RepeatHeader').eq(0).hide();

for( i=1;i<=j;i++){

if(i % 5 != 0 ){jQuery('tbody tr.RepeatHeader').eq(i).hide();}

}



});



Qualtrics.SurveyEngine.addOnReady(function()

{

/*Place your JavaScript here to run when the page is fully displayed*/



});



Qualtrics.SurveyEngine.addOnUnload(function()

{

/*Place your JavaScript here to run when the page is unloaded*/



});
> @BethW said:

> I paste the script here in the question as shown below. But it's not working for me. Thoughts?



I hope you have followed this instruction - Check the 'All' option in the Repeat headers
I did.
This worked when my response options ranged from "strongly disagree-strongly agree" - but, it doesn't work when I use a frequency scale. Any ideas on how to fix this problem? Many thanks.
To clarify -- I want a "repeat header" for every 5th item for two blocks of 65 items each using a matrix structure (Note: The two blocks are identical, such that they both have Likert scales, but the only difference is that Block 1 uses a "strongly disagree-strongly agree" scale and the other uses a "very unclear-very clear" scale). I pasted the script listed above by BethW, and it worked for Block 1, but not Block 2. How can I fix this problem?
I'm currently having a similar issue to j_b. Except when I past my code, it only does the repeating of the headers for n rows twice and then reverts back to every row having a header.



How do I make it so it repeats headers for n rows throughout the WHOLE matrix?

Leave a Reply