using hidden column data

using hidden column data

sonicbugsonicbug Posts: 26Questions: 0Answers: 0
edited November 2010 in General
Hi I am trying to use the value of a hidden column (column 4) in an if/else statement to populate a tooltip. The only way I can get the tooltip to work is when the column is not hidden. Any suggestions greatly appreciated.

[code]
$.get("outcomePages/kindergarten/csv/kindergarten.csv", function(data) {
csv_contents = $.csv()(data);

/* generate dynamic table */
$('#kslolist').html('');

var oTable = $('#kslolist_table').dataTable({
"sPaginationType": "full_numbers",
"aaSorting": [[0, "desc"]],
"aaData": csv_contents,
"aoColumns": [
{ "sTitle": "SLO" },
{ "sTitle": "Description" },
{ "sTitle": "GLO" },
{ "sTitle": "Lesson Plans" },
/*{ "sTitle": "Worksheet ID" }*/
{"bVisible": false, "bSearchable": true }

]

});


$('#kslolist_table tbody tr').each(function() {
var sTitle;
var nTds = $('td', this);
var sSlo = $(nTds[0]).text();
var sLesson = $(nTds[3]).text();
var sWorksheetID = $(nTds[4]).text();
var tooltip;


switch (sSlo) {
case 'K-I-02':
tooltip = 'Students will see how trees and vegetation help fish hide when they try to find the hidden fish in the pictures. They will also discover how skin colour helps to camouflage fish in their environment.'
break;
case 'K-I-05':
if (sWorksheetID == "1")
tooltip = 'In this activity, students will be shown four pictures, each representing a different season. They will then have to match each picture to the corresponding season. Later, they will have to think of and describe activities that correspond with each season. For example, ice fishing can correspond with the winter scene. For an extra challenge, have students draw their own winter, spring, summer or fall scenes!';
else if (sWorksheetID == "2")
tooltip = 'In this activity, students will be shown four pictures, each representing a different season. They will then have to match each picture to the corresponding season. Later, they will have to think of and describe activities that correspond with each season. For example, ice fishing can correspond with the winter scene. For an extra challenge, have students draw their own winter, spring, summer or fall scenes!';
else
tooltip = 'no description';
break;
case 'K-2-03':
if (sWorksheetID == "1")
tooltip = 'Students will cut out and create their very own fish hats! They will choose their own colours and then compare the different fish in the class using the appropriate terms for colour comparisons.';
else if (sWorksheetID == "2")
tooltip = 'Students will colour the matching fish (i.e. fish of the same species) the same colour. They will then compare their own fish with another classmate"s fish using appropriate terms for comparing colours.';
else
tooltip = 'no description';
break;
case 'K-2-07':
tooltip = 'Students will create and colour a wall-sized mural of an underwater scene. As they colour the mural, they will decide which colours best represent an underwater environment. They can then add some Manitoba fish species to the mural. They can even draw and colour their own fish to add!';
break;
case 'K-3-05':
tooltip = 'Folding fish is fun! Students will have to choose an appropriate piece of paper and create their own fish! Students can personalize them and display them around the classroom or even create hanging mobiles of fish in every colour!';
break;
default:
break;
}

sTitle = '' + sLesson + '' + tooltip + '';
this.setAttribute('title', sTitle);
});
/* Apply the tooltip */
$(oTable.fnGetNodes()).tooltip({
position: 'bottom center',
offset: [0, -85]
});


});
[/code]
This discussion has been closed.