Index: trunk/extensions/UsabilityInitiative/ClickTracking/SpecialClickTracking.js |
— | — | @@ -78,11 +78,11 @@ |
79 | 79 | |
80 | 80 | var setContribs = function(conditionArray, contribName){ |
81 | 81 | |
82 | | - initialDiv = $("<div>").attr("id", contribName +"_div"); |
| 82 | + initialDiv = $("<div></div>").attr("id", contribName +"_div"); |
83 | 83 | initialDiv.addClass("checkbox_div"); |
84 | 84 | initialDiv.addClass("control_div"); |
85 | 85 | |
86 | | - textDiv = $("<div>").attr("id", contribName +"_text_div"); |
| 86 | + textDiv = $("<div></div>").attr("id", contribName +"_text_div"); |
87 | 87 | mainCheckbox = $("<input>").attr("id", contribName +"_checkbox"); |
88 | 88 | mainCheckbox.attr("type", "checkbox"); |
89 | 89 | mainCheckbox.addClass("user_def_checkbox"); |
— | — | @@ -100,12 +100,12 @@ |
101 | 101 | |
102 | 102 | |
103 | 103 | var buildConditionDiv = function (condition, counter, isChecked){ |
104 | | - conditionDiv = $("<div>").attr("id", contribName + "_range_" + counter + "_div"); |
| 104 | + conditionDiv = $("<div></div>").attr("id", contribName + "_range_" + counter + "_div"); |
105 | 105 | conditionDiv.addClass("checkbox_div"); |
106 | 106 | conditionDiv.addClass("sub_option_div"); |
107 | 107 | |
108 | 108 | //initialDiv.append(conditionDiv); |
109 | | - cCheckbox = $("<input>").attr("id", contribName+"_"+counter+"_checkbox"); |
| 109 | + cCheckbox = $("<input></input>").attr("id", contribName+"_"+counter+"_checkbox"); |
110 | 110 | cCheckbox.attr("type", "checkbox"); |
111 | 111 | if(isChecked){ |
112 | 112 | cCheckbox.attr("checked", true); |
— | — | @@ -113,10 +113,10 @@ |
114 | 114 | cCheckbox.addClass("number_select_checkbox"); |
115 | 115 | conditionDiv.append(cCheckbox); |
116 | 116 | |
117 | | - cSelect = $("<select>").attr("id", contribName+"_"+counter+"_ltgt"); |
| 117 | + cSelect = $("<select></select>").attr("id", contribName+"_"+counter+"_ltgt"); |
118 | 118 | cSelect.addClass("number_select_ltgt"); |
119 | 119 | |
120 | | - cOpt1 = $("<option>").attr("id", contribName+"_"+counter+"_lt"); |
| 120 | + cOpt1 = $("<option></option>").attr("id", contribName+"_"+counter+"_lt"); |
121 | 121 | cOpt1.addClass("number_select_ltgt_opt"); |
122 | 122 | cOpt1.attr("value", "lt"); |
123 | 123 | cOpt1.text("<"); |
— | — | @@ -125,7 +125,7 @@ |
126 | 126 | } |
127 | 127 | |
128 | 128 | |
129 | | - cOpt2 = $("<option>").attr("id", contribName+"_"+counter+"_gt"); |
| 129 | + cOpt2 = $("<option></option>").attr("id", contribName+"_"+counter+"_gt"); |
130 | 130 | cOpt2.addClass("number_select_ltgt_opt"); |
131 | 131 | cOpt2.attr("value", "gt"); |
132 | 132 | cOpt2.text(">"); |
— | — | @@ -133,7 +133,7 @@ |
134 | 134 | cOpt2.attr("selected", true); |
135 | 135 | } |
136 | 136 | |
137 | | - cOpt3 = $("<option>").attr("id", contribName+"_"+counter+"_lteq"); |
| 137 | + cOpt3 = $("<option></option>").attr("id", contribName+"_"+counter+"_lteq"); |
138 | 138 | cOpt3.addClass("number_select_ltgt_opt"); |
139 | 139 | cOpt3.attr("value", "lteq"); |
140 | 140 | cOpt3.text("<="); |
— | — | @@ -141,7 +141,7 @@ |
142 | 142 | cOpt3.attr("selected", true); |
143 | 143 | } |
144 | 144 | |
145 | | - cOpt4 = $("<option>").attr("id", contribName+"_"+counter+"_gteq"); |
| 145 | + cOpt4 = $("<option></option>").attr("id", contribName+"_"+counter+"_gteq"); |
146 | 146 | cOpt4.addClass("number_select_ltgt_opt"); |
147 | 147 | cOpt4.attr("value", "gteq"); |
148 | 148 | cOpt4.text(">="); |
— | — | @@ -155,7 +155,7 @@ |
156 | 156 | cSelect.append(cOpt4); |
157 | 157 | conditionDiv.append(cSelect); |
158 | 158 | |
159 | | - cTextInput = $("<input>").attr("id", contribName+"_"+counter+"_text"); |
| 159 | + cTextInput = $("<input></input>").attr("id", contribName+"_"+counter+"_text"); |
160 | 160 | cTextInput.addClass("number_select_text"); |
161 | 161 | cTextInput.attr('value', condition["value"]); |
162 | 162 | conditionDiv.append(cTextInput); |
— | — | @@ -170,7 +170,7 @@ |
171 | 171 | initialDiv.append(conditionDiv); |
172 | 172 | } //forloop |
173 | 173 | initialDiv.data("totalConditions", i); |
174 | | - addConditions = $("<div>").attr("id", contribName+"_addbutton"); |
| 174 | + addConditions = $("<div></div>").attr("id", contribName+"_addbutton"); |
175 | 175 | addConditions.data("contribName", contribName); |
176 | 176 | addConditions.addClass("add_condition_button"); |
177 | 177 | addConditions.text("+"); |
— | — | @@ -293,6 +293,7 @@ |
294 | 294 | $.colorizeTable = function (){ |
295 | 295 | //expert |
296 | 296 | |
| 297 | + |
297 | 298 | //get totals |
298 | 299 | var expert_total = 0; |
299 | 300 | |
— | — | @@ -367,37 +368,42 @@ |
368 | 369 | $.updateTable = function(){ |
369 | 370 | |
370 | 371 | var processTableJSON = function(data, status){ |
371 | | - $("#clicktrack_data_table").empty(); |
| 372 | + |
| 373 | + //clear |
| 374 | + $(".table_data_row").each(function(){ $(this).remove();}); |
| 375 | + |
372 | 376 | var row_count = 0; |
373 | | - for( var row in data['tablevals']['vals']){ |
| 377 | + for( var row_iter in data['tablevals']['vals']){ |
| 378 | + var row = data['tablevals']['vals'][row_iter]; //really, JS? |
374 | 379 | row_count++; |
375 | | - var outputRow = $("<tr>"); |
| 380 | + |
| 381 | + var outputRow = $("<tr></tr>"); |
376 | 382 | outputRow.addClass("table_data_row"); |
377 | 383 | |
378 | | - var cell =$("<td>").attr("id", "event_name_" + row_count); |
| 384 | + var cell =$("<td></td>").attr("id", "event_name_" + row_count); |
379 | 385 | cell.addClass("event_name"); |
380 | 386 | cell.attr("value", row['event_id']); |
381 | | - cell.append(row['event_name']); |
382 | | - |
| 387 | + cell.text(row['event_name']); |
383 | 388 | outputRow.append(cell); |
384 | 389 | |
385 | 390 | var createClassCell = function(userclass){ |
386 | | - var newcell = $("<td>").attr("id", "event_"+userclass+"_" + row_count); |
| 391 | + var newcell = $("<td></td>").attr("id", "event_"+userclass+"_" + row_count); |
387 | 392 | newcell.addClass("event_data"); |
388 | 393 | newcell.addClass(userclass+"_data"); |
389 | | - newcell.append(row[userclass]); |
| 394 | + newcell.text(row[userclass]); |
| 395 | + newcell.attr("value", row[userclass]); |
390 | 396 | outputRow.append(newcell); |
| 397 | + |
391 | 398 | }; |
392 | 399 | |
393 | 400 | createClassCell("expert"); |
394 | 401 | createClassCell("intermediate"); |
395 | 402 | createClassCell("basic"); |
396 | 403 | createClassCell("total"); |
397 | | - |
398 | 404 | $("#clicktrack_data_table").append(outputRow); |
399 | 405 | } |
| 406 | + |
400 | 407 | $.colorizeTable(); |
401 | | - |
402 | 408 | }; |
403 | 409 | |
404 | 410 | |