Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Grid questions with different columns

Hi,
I want the following table/grid

--------------a-----------b
Row1----Item1-----Item2
Row2----Item3-----Item4
Row3----Item5-----Item6
Row4----Item7-----Item8

When choosing grid question, I cannot edit the name of the cells. They are empty, they have only the radio button. But I want to write something next to the radio buttons.
But I cannot find how.
asked Nov 17, 2017 by anonymous

1 Answer

0 votes
In the grid settings, select the rows / columns you want to add text to, then click "Edit."  Within the window that opens, look for "Cell Input Labels."  Any text here will appear before / after the radio buttons in the grid question.
answered Nov 17, 2017 by Zachary Platinum Sawtooth Software, Inc. (81,525 points)
Ok.
But now it looks like this
https://prnt.sc/hbs7zm
I dont want to have the same cell input labels for each row, they should be different.
Like:
Hello ---- [ ] Zachary ----- [ ] Anonymous
Is this a row or column based grid?  What labels do you want for each cell?
I think it is row based.
I want different labels.
Item ---- Option1 --------- Option2
Color---- [ ] red----------- [ ] green
Car------ [ ] Mercedes ----- [ ] Audi
etc.
I also want to appear the cells in a random order
So some subjects see green as first option and red second. But variables should stay of course (green should always be row1_col2)
Set the cell input label to this:

<span class="custom_input_label"></span>


Then put this code in the grid's footer:

<script>
$(document).ready(function(){
    $('#[% QuestionName() %]_r1_1').closest('.clickable').find('.custom_input_label').text('r1c1');
    $('#[% QuestionName() %]_r1_2').closest('.clickable').find('.custom_input_label').text('r1c2');
    $('#[% QuestionName() %]_r2_1').closest('.clickable').find('.custom_input_label').text('r2c1');
    $('#[% QuestionName() %]_r2_2').closest('.clickable').find('.custom_input_label').text('r2c2');
})
</script>


That will handle the first four radio buttons.  You can copy-and-paste the lines of code for however many rows and columns you have.
Perfect. Works :)

But I can´t see the randomization.
I want in each row to have a randomization of the two options. Is this possible?
Randomize the columns in the grid settings.
That doesn´t work. It changes the column only. So r1_1 will be r1_2, but at the same time r2_1 will be 2_2. That´s not what I want.
I want to have a mix in the end.
You want the radio buttons of each row to be randomized independently of the other rows?
Yes, exactly, that is correct. :)
<script>
$(document).ready(function(){
    if (!$('#[% QuestionName() %]_div .mobile_grid').length){
        $('#[% QuestionName() %]_div .inner_table > tbody > tr:not(:first-child)').each(function(){
            if (Math.random() > 0.5) {
                $(this).append($(this).children(':nth-child(2)'));
            }
        });
    }
    else {
        $('#[% QuestionName() %]_div .mobile_grid_options').each(function(){
            if (Math.random() > 0.5) {
                $(this).append($(this).children(':first-child'));
            }
        });
    }
})
</script>
Yes! That´s working perfectly!

But how the hell can I ever get alone to this complicated code :(

Just one minor question:
Why can I always open only one preview window? It is really annoying if you want to compare two or more layouts if you always need to close the preview window and open it again :/
Learning to code is just like learning any other skill.  You just learn a little bit everyday and with time it becomes second nature.

I know the flow of some of the windows in Lighthouse Studio can be a little frustrating at times.  It would be great to overhaul the general flow of Lighthouse settings, but I can't say if or when that will happen.
Thank you Zachary for your stamina and helping :)

 Also the HTML buttons in the text editor windows are outdated (like HTML font tag, which isn´t supported any longer in HTML5). And I hope the flow will be improved soon. Great software though :)
...