Mercurial > hg > STI-GWT
view war/scripts/sti/STITable.js @ 3:cf06b77a8bbd
Committed branch of the e4D repos sti-gwt branch 16384.
git-svn-id: http://dev.dariah.eu/svn/repos/eu.dariah.de/ap1/sti-gwt-dariah-geobrowser@36 f2b5be40-def6-11e0-8a09-b3c1cc336c6b
author | StefanFunk <StefanFunk@f2b5be40-def6-11e0-8a09-b3c1cc336c6b> |
---|---|
date | Tue, 17 Jul 2012 13:34:40 +0000 |
parents | |
children |
line wrap: on
line source
/** * defines the table component of the Spatio Temporal Interface * @param {STICore} core the sti core component, the table component has to deal with * * @constructor */ function STITable(core){ this.core = core; this.baseRow; this.dynamicTables; this.tableColumns; this.initialize(); } STITable.prototype = { /** * initializes the table component by creating a table with a single row, which cells will contain the tables of data sets */ initialize: function(){ this.dynamicTables = []; var baseTable = document.createElement("table"); document.getElementById("dataTables").appendChild(baseTable); baseTable.cellSpacing = "20"; this.baseRow = baseTable.insertRow(0); this.tableColumns = []; this.status = 0; document.getElementById("dataTables").onselectstart = function(){ return false; }; }, /** * deletes all tables */ deleteTables: function(){ for (var i = this.tableColumns.length; i > 0; i--) { this.baseRow.removeChild(this.tableColumns[i-1]); delete this.tableColumns[i-1]; delete this.dynamicTables[i-1]; this.tableColumns.pop(); this.dynamicTables.pop(); } }, /** * initializes the tables for given datasets * @param {Array} objects an array of object-array, which contain all elements that are in the actual display set * @param {DataSet[]} dataSets all dataSets; needed for the header rows of the data tables */ initTables: function(dataSets){ this.deleteTables(); for (var i = 0; i < dataSets.length; i++) { var dynamicTable = new DynamicTable(this.core,dataSets[i],i); var column = this.baseRow.insertCell(0); column.width = Math.floor(100 / dataSets.length) + '%'; column.appendChild(dynamicTable.tableDiv); this.tableColumns.push(column); this.dynamicTables.push(dynamicTable); } }, /** * updates each dynamic table */ updateTables: function(){ for (var i = 0; i < this.dynamicTables.length; i++){ this.dynamicTables[i].update(); } } }