From 91ee1419aa9f4aecde48e3d754d3cacf2506303c Mon Sep 17 00:00:00 2001 From: rolux Date: Thu, 14 Jun 2012 15:46:57 +0200 Subject: [PATCH] Ox.Spreadsheet: allow for not passing options.value.values --- source/Ox.UI/js/Form/Spreadsheet.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/source/Ox.UI/js/Form/Spreadsheet.js b/source/Ox.UI/js/Form/Spreadsheet.js index d7c8b488..2947f61b 100644 --- a/source/Ox.UI/js/Form/Spreadsheet.js +++ b/source/Ox.UI/js/Form/Spreadsheet.js @@ -36,13 +36,17 @@ Ox.Spreadsheet = function(options, self) { self.options.value.rows.push(''); self.options.value.values.push([0, 0, 0, 0]); }); - } else if (Ox.isEmpty(self.options.value.values)) { - self.options.value.rows.forEach(function(row, r) { - self.options.value.values.push([]); - self.options.value.columns.forEach(function(column, c) { - self.options.value.values[r].push(0); + } else { + self.options.value.values = self.options.value.values || []; + if (Ox.isEmpty(self.options.value.values)) { + self.options.value.values = []; + self.options.value.rows.forEach(function(row, r) { + self.options.value.values.push([]); + self.options.value.columns.forEach(function(column, c) { + self.options.value.values[r].push(0); + }); }); - }); + } } renderSpreadsheet();