How To Create Compound Grids

Overview

The compound grids, is a loop of X questions which is shown as a grid instead of looping over the questions one by one. For example, you can display all the questions of an iteration as a grid. 

Steps:

1. Create a chapter that will hold different question types (Single Choice, Multiple Selection, Open Ended etc.)

2. Set the chapter to run in a loop. 

3. On the Loops tab we’ve added the new “Render as grid”:

Which will then render the loop as a grid with each question being a column and each row being a loop iteration:

Compound Grid Callback Function - OnRenderGridInit()

In order to pipe the function 'OnRenderGridInit() should be used as follows:

function OnRenderGridInit(inChapterIndex, ioParams){
 if(inChapterIndex==3) //Verifies that the chapter is chapter 7
 {
 for(var i=1; i<=6; i++)
 {
  var IterationText = AnswerChoice(QRef(101),i);
  ioParams.Rows[i].Name = IterationText;
  }
 }
}

You can also use this function to set the alignment and other params for the Grid

function OnRenderGridInit(inChapterIndex, ioParams){
if (inChapterIndex == 3){ 
ioParams.CellAlignment = eRenderGridAlignment.Center;
ioParams.ColumnHeaderAlignment = eRenderGridAlignment.Top;
ioParams.RowHeaderAlignment = eRenderGridAlignment.Bottom;

ioParams.Columns[0].WidthPercentage = 10;
ioParams.Columns[1].WidthPercentage = 70;
ioParams.Columns[2].WidthPercentage = 20;
}
}

 

In the attached example survey you would find a demonstration of the how to implement this type of logic. 

In order to test the sample, please follow this manual on how to import the survey to your studio - http://support.dooblo.net/entries/22388573-How-to-import-a-survey

That's It !

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.