void OnRenderGridInit(int inChapterIndex, RenderGridParams ioParams)
Description
This callback function is called when a chapter is set as compound grid and there is a need to change/update some of the parameters, please click here to learn more on compound grid.
Parameters
The following is a list of parameters the functions receives
Parameter | Type | Description |
---|---|---|
inCahpterIndex | Int32 | the chapter index |
ioParams | The different parameters to set |
Return Type
void
Example
This example below will check if the compound grid is chapter 3 and if true it will do the following:
- Align the grid center
- Align the Column headers to top
- Align the Row headers to bottom
- Set the column width percentage accordingly
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;
}
}
Full properties details:
Class RenderGridParams:
Fields:
//These control the alignments of the various elements… eRenderGridAlignment should autocomplete to Top, Center, bottom
eRenderGridAlignment CellAlignment
eRenderGridAlignment ColumnHeaderAlignment
eRenderGridAlignment RowHeaderAlignment
Column[] mColumns; //Information regarding all the table columns
Methods:
//The Columns of the grid
Column[] getColumns()
//The Rows of the grid
Row[] getRows()
//Get a specific row by its iteration index
Row GetRowByIterationIndex(int inIterationIndex)
//Get a specific column by its question index
Column GetColumnByQuestionIndex(int inQuestionIndex)
enum eRenderGridAlignment:
Top(0),
Center(1),
Bottom(2);
Column and Row are:
class Column
{
public int QuestionIndex; //1 based, since access through UL
public int WidthPercentage; //number between 0-100… I’ll automatically normalize the values if the sum of all columns is greater than 100
public String Name;
}
public static class Row
{
public int IterationIndex; //1 based, since access through UL
public String Name;
}
Comments
Hi! How can I add Title with the grid display? Regards
Please sign in to leave a comment.