comparison war/scripts/sti/DynamicTable.js @ 40:20eb7596d466 CellTable

Preparation for a switch to a CellTable. This is work in progress.
author Sebastian Kruse <skruse@mpiwg-berlin.mpg.de>
date Thu, 06 Dec 2012 18:05:39 +0100
parents cf06b77a8bbd
children
comparison
equal deleted inserted replaced
39:ba7d401c2750 40:20eb7596d466
3 */ 3 */
4 function DynamicTable(core, dataSet, index){ 4 function DynamicTable(core, dataSet, index){
5 5
6 this.core = core; 6 this.core = core;
7 this.dataSet = dataSet; 7 this.dataSet = dataSet;
8 this.chunks = [];
9 this.index = index; 8 this.index = index;
10 this.tableDiv; 9 this.tableDiv;
11 this.tableHeader; 10 this.tableHeader;
12 this.tableBody; 11 this.tableBody;
13 this.tableFooter; 12 this.tableFooter;
20 } 19 }
21 20
22 DynamicTable.prototype = { 21 DynamicTable.prototype = {
23 22
24 initialize: function(){ 23 initialize: function(){
24 /*
25 25
26 this.chunks.push([]); 26 this.chunks.push([]);
27 for (var i = 0; i < this.dataSet.objects.length; i++) { 27 for (var i = 0; i < this.dataSet.objects.length; i++) {
28 if (this.chunks[this.chunks.length - 1].length == tableElements) 28 if (this.chunks[this.chunks.length - 1].length == tableElements)
29 this.chunks.push([]); 29 this.chunks.push([]);
153 footerRow.appendChild(tfoot); 153 footerRow.appendChild(tfoot);
154 154
155 table.appendChild(this.tableFooter); 155 table.appendChild(this.tableFooter);
156 156
157 this.createTableBody(); 157 this.createTableBody();
158 158 */
159 }, 159 },
160 160
161 createRow: function(object, index){ 161 createRow: function(object, index){
162 /*
162 163
163 var base = this; 164 var base = this;
164 165
165 var dataRow = document.createElement("tr"); 166 var dataRow = document.createElement("tr");
166 167
234 placeCell.style.borderTop = "none"; 235 placeCell.style.borderTop = "none";
235 timeCell.style.borderTop = "none"; 236 timeCell.style.borderTop = "none";
236 } 237 }
237 238
238 return dataRow; 239 return dataRow;
240 */
239 241
240 }, 242 },
241 243
242 createTableBody: function(){ 244 createTableBody: function(){
245 /*
243 try { 246 try {
244 var selectedChunk = parseInt(this.chunkSelect.value); 247 var selectedChunk = parseInt(this.chunkSelect.value);
245 if (selectedChunk > this.chunks.length) { 248 if (selectedChunk > this.chunks.length) {
246 throw "Exception"; 249 throw "Exception";
247 } 250 }
259 var row = this.createRow(this.chunks[this.actualChunk][i], index); 262 var row = this.createRow(this.chunks[this.actualChunk][i], index);
260 this.tableBody.appendChild(row); 263 this.tableBody.appendChild(row);
261 this.rows.push(row); 264 this.rows.push(row);
262 } 265 }
263 this.update(); 266 this.update();
267 */
264 }, 268 },
265 269
266 update: function(){ 270 update: function(){
271 /*
267 for (var i = 0; i < this.chunks[this.actualChunk].length; i++) { 272 for (var i = 0; i < this.chunks[this.actualChunk].length; i++) {
268 var object = this.chunks[this.actualChunk][i]; 273 var object = this.chunks[this.actualChunk][i];
269 var p = object.percentage; 274 var p = object.percentage;
270 if (object.hoverSelect) { 275 if (object.hoverSelect) {
271 p = 1; 276 p = 1;
273 var r = cellColor.r + Math.round(p * (colors[this.index].rt - cellColor.r)); 278 var r = cellColor.r + Math.round(p * (colors[this.index].rt - cellColor.r));
274 var g = cellColor.g + Math.round(p * (colors[this.index].gt - cellColor.g)); 279 var g = cellColor.g + Math.round(p * (colors[this.index].gt - cellColor.g));
275 var b = cellColor.b + Math.round(p * (colors[this.index].bt - cellColor.b)); 280 var b = cellColor.b + Math.round(p * (colors[this.index].bt - cellColor.b));
276 this.rows[i].style.background = 'rgb(' + r + ',' + g + ',' + b + ')'; 281 this.rows[i].style.background = 'rgb(' + r + ',' + g + ',' + b + ')';
277 } 282 }
283 */
278 } 284 }
279 285
280 } 286 }