Show column header in text grid question

From Catglobe Wiki
Revision as of 12:35, 2 February 2012 by Cg van (talk | contribs) (Code)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Challenge

In order to indicate the unit of values to be put inside a text grid question

As a questionnaire creator

I want to add headers to columns in text grid question

Example
ShowColHeaderInTextGrid.jpg

Solution

  • Add a Text grid question to Questionnaire editor like below
  • Go to menu Properties -> Question scripts -> Java script tab -> Input script

ShowColHeaderInTextGrid Code.jpg

Code

quest.onInit = function()
{
	$("#grid_subquestion_text_1").parent().before($("<tr><th></th><th>Personal information</th></tr>"));
}

Source

Questionnaire Resource Id on cg site: 159730