Have an idea?

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

HTML Column Merging

I had  question regarding HTML column merging. I have a constructed list with multiple rows and columns and i would like to merge the columns together but it separated as different columns .

For example - i want the view to be like this

             Year                                               Month
Holidays        Salary             Holiday                 Salary

Currently my View is

Year                       Year
Holiday                 Salary
asked Jun 8, 2017 by anonymous

1 Answer

+1 vote
This may not be the best or most up to date solution but it may suit your needs?

Create a parent list with the following codes defined ...


Create a grid question with the columns using the above mentioned parent list. The rows will use a single row blank list.

Set the grid direction to rows.

Set your input type - radio button / check boxes / numeric / etc.

Pop this JavaScript into the footer of your grid question ...
 row_html = "<tr></td><td align='center' colspan='2'>Year</td><td align='center' colspan='2'>Month</td></tr>";

Good luck.
answered Jun 8, 2017 by Paul Moon Platinum (67,780 points)
That about sums up the code I was about to write.  The one thing I would add would be to put "<td>" between "<tr>" and "</td>."  The code may run without it, but it's good practice to make sure every opening and closing tag match up.
Thanks Zachary. I noticed the tag issue and corrected it in my ssi file but had forgotten to attend to it on the forum.

Corrected script ...
 row_html = "<tr><td align='center' colspan='2'>Year</td><td align='center' colspan='2'>Month</td></tr>";