Difference between revisions of "Show column header in text grid question"

From Catglobe Wiki
Jump to: navigation, search
(New page: ==Challenge== In order to indicate the unit of values to be put inside a text grid question<br/> As a questionnaire creator<br/> I want to add headers to columns in text grid question<br/>...)
 
Line 1: Line 1:
 
==Challenge==
 
==Challenge==
In order to indicate the unit of values to be put inside a text grid question<br/>
+
In order to indicate the unit of values to be put inside a text grid question
As a questionnaire creator<br/>
+
 
I want to add headers to columns in text grid question<br/>
+
As a questionnaire creator
'''Example'''<br/>
+
 
[[Image:Show_column_header_in_text_grid.png]]
+
I want to add headers to columns in text grid question
 +
 
 +
'''Example'''
 +
<br/>
 +
[[Image:ShowColHeaderInTextGrid.jpg]]
 +
 
 
==Solution==
 
==Solution==
Locate the first sub question's row, add the new row containing the headers before that row.
+
*Add a Text grid question to Questionnaire editor like below
 +
*Go to menu Properties -> Question scripts -> Java script tab -> Input script
 +
[[Image:ShowColHeaderInTextGrid Code.jpg]]
 +
 
 
==Code==
 
==Code==
 
<source lang="javascript">
 
<source lang="javascript">
Line 14: Line 22:
 
}
 
}
 
</source>
 
</source>
 +
 +
==Source==
 +
Questionnaire Resource Id on cg site: 159730

Revision as of 11:34, 2 February 2012

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>Antal minutter</th></tr>"));
}

Source

Questionnaire Resource Id on cg site: 159730