From afcc8a6646830467e483198f48b3953d17e257da Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Tue, 2 Aug 2016 15:34:57 +0200 Subject: [PATCH] Update spreadsheet cell --- Spreadsheet/Cell.js | 22 ++++++++++++++++++++++ Spreadsheet/Spreadsheet.js | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 Spreadsheet/Cell.js diff --git a/Spreadsheet/Cell.js b/Spreadsheet/Cell.js new file mode 100644 index 0000000..d6314d0 --- /dev/null +++ b/Spreadsheet/Cell.js @@ -0,0 +1,22 @@ +/** + * Cell. + * + * @author OMS Development Team + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 * @since 1.0.0 + */ +(function (jsOMS) +{ + "use strict"; + /** @namespace jsOMS.Spreadsheet */ + jsOMS.Autoloader.defineNamespace('jsOMS.Spreadsheet'); + + jsOMS.Spreadsheet.Cell = function(id, raw) + { + this.id = id; + this.raw = raw; + this.formatting = raw.formatting; + }; +}(window.jsOMS = window.jsOMS || {})); \ No newline at end of file diff --git a/Spreadsheet/Spreadsheet.js b/Spreadsheet/Spreadsheet.js index 7af6daa..7b6afc9 100644 --- a/Spreadsheet/Spreadsheet.js +++ b/Spreadsheet/Spreadsheet.js @@ -1,5 +1,5 @@ /** - * Form view. + * Spreadsheet view. * * @author OMS Development Team * @author Dennis Eichhorn @@ -13,11 +13,39 @@ /** @namespace jsOMS.Spreadsheet */ jsOMS.Autoloader.defineNamespace('jsOMS.Spreadsheet'); - jsOMS.Spreadsheet.Spreadsheet = function(id, options) + jsOMS.Spreadsheet.Spreadsheet = function(id, dataset, options) { + this.spreadsheet = document.getElementById(id); this.title = ''; this.sheets = []; this.columns = true; this.rows = true; + this.dataset = []; + this.compiledData = []; + this.scroll = {h: false, v: false}; + }; + + jsOMS.SpreadSheet.prototype.draw = function() + { + let col = 0, + row = 0, + cRows = this.dataset.length(), + cCols = 0; + j = 0, + this.compiledData = this.dataset; + + for(let i = 0; i < cRows; i++) { + cCols = this.compiledData[i].length(); + + for(j = 0; j < cCols; j++) { + this.compiledData[i][j] = Functions.evaluate(this.compiledData[i][j], compiledData); + + this.drawCell(this.compiledData[i][j]); + } + } + }; + + jsOMS.SpreadSheet.prototype.drawCell = function() + { }; }(window.jsOMS = window.jsOMS || {})); \ No newline at end of file