Have an idea?

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

Change grid type for only one column

Hi Guys,

I have this regular grid row-wise, and i want the last column to be open-ended (for each row), the software only allow me edit the type for the whole row at once, here is a screenshot: https://i.ibb.co/MfPcg6S/Capture.png

 So any help?  Thanks..
asked Nov 19, 2019 by Ahmed Anwer (495 points)

1 Answer

+1 vote
Best answer
This isn't possible with a single grid question, but one option we could do is to use two grid questions on the same page and effectively combine them using JavaScript.  Both questions will need the same list of rows; the first will need the radio options as columns, the second with the open-end options as its column.

The first grid question can be given this script:

    var secondGridQDiv = $('#[% QuestionName() %]_div').nextAll('.grid').eq(0);
    if (!$('#[% QuestionName() %]_div .mobile_grid').length) {
        var firstTable = $('#[% QuestionName() %]_div .inner_table');
        var secondTable = $(secondGridQDiv).find('.inner_table');
        for (var tr = 1; tr <= $(firstTable).find('> tbody > tr').length; tr++) {
            $(firstTable).find('> tbody > tr:nth-child(' + tr + ')').append($(secondTable).find('> tbody > tr:nth-child(' + tr + ') > td:last-child'));
    else {
        var firstMobileGrid = $('#[% QuestionName() %]_div .mobile_grid');
        var secondMobileGrid = $(secondGridQDiv).find('.mobile_grid');
        for (var i = 1; i <= $(firstMobileGrid).children().length; i++) {
            $(firstMobileGrid).find('> .mobile_grid_card:nth-child(' + i + ') .mobile_grid_options').append($(secondMobileGrid).find('> .mobile_grid_card:nth-child(' + i + ') .mobile_grid_options').children());

And the second grid question can be given this code:

#[% QuestionName() %]_div {
    display: none;

You will want to test thoroughly to confirm that the appearance of the resulting grid question looks how you want.
answered Nov 19, 2019 by Zachary Platinum Sawtooth Software, Inc. (147,200 points)
selected Nov 20, 2019 by Ahmed Anwer
Thank you, it worked perfectly.