Have an idea?

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

How can i measure one grid questions along two metrics?

i am trying to generate a grid with
                metric 1  metric 2
row x    1 2 3 4 5 | 1 2 3 4 5

i.e. row x is ease of use, while metric 1 would be "not important to extremely important (1-5)" and metric 2 would be "worse than competition to better than competition (1-5)".

as you probably can tell, i just started using sawtooth and dont have much experience with HTML either - however, any help would be extremely appreciated.

BR,

tom
asked Sep 14, 2018 by anonymous

1 Answer

0 votes
I've got a rough start finished.  I started by adding two grid questions to the same page.  They should both be using the same rows list, of course.  I then placed this code in the second grid question:

<style>
#[% QuestionName() %]_div {
    display: none;
}
</style>

<script>
$(document).ready(function(){
    var gridQ1 = 'GridQ1';
    var gridQ2 = 'GridQ2';
    
    var rows = $('#' + gridQ1 + '_div .inner_table > tbody > tr').length;
    for (var r = 1; r <= rows; r++) {
        var tdSelector = '#' + gridQ2 + '_div .inner_table > tbody > tr:nth-child(' + r + ') > td:nth-child(2)';
        while ($(tdSelector).length) {
            $('#' + gridQ1 + '_div .inner_table > tbody > tr:nth-child(' + r + ')').append($(tdSelector));
        }
    }
})
</script>


"GridQ1" and "GridQ2" must be replaced with the names of the two grid questions.
answered Sep 14, 2018 by Zachary Platinum Sawtooth Software, Inc. (115,825 points)
Thanks, was exactly what i was looking for!
Red alert frames when forgetting to tick a box
...