Difference between revisions of "Show column header in text grid question"
(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/>...) |
(→Code) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
==Challenge== | ==Challenge== | ||
− | In order to indicate the unit of values to be put inside a text grid question | + | 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 | + | As a questionnaire creator |
− | '''Example'''<br/> | + | |
− | [[Image: | + | I want to add headers to columns in text grid question |
+ | |||
+ | '''Example''' | ||
+ | <br/> | ||
+ | [[Image:ShowColHeaderInTextGrid.jpg]] | ||
+ | |||
==Solution== | ==Solution== | ||
− | + | *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"> | ||
quest.onInit = function() | quest.onInit = function() | ||
{ | { | ||
− | $("#grid_subquestion_text_1").parent().before($("<tr><th></th><th> | + | $("#grid_subquestion_text_1").parent().before($("<tr><th></th><th>Personal information</th></tr>")); |
} | } | ||
</source> | </source> | ||
+ | |||
+ | ==Source== | ||
+ | Questionnaire Resource Id on cg site: 159730 |
Latest revision as of 11:35, 2 February 2012
Contents
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
Solution
- Add a Text grid question to Questionnaire editor like below
- Go to menu Properties -> Question scripts -> Java script tab -> Input script
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