handsontable updated to succesfully restore previously stored data

parent ed20ca33
...@@ -86,11 +86,17 @@ ...@@ -86,11 +86,17 @@
}) })
.push(function (result_list) { .push(function (result_list) {
var i, content, var i, content,
data = JSON.parse(result_list[0]) result = JSON.parse(result_list[0]),
.application_configuration.input; config = result.application_configuration.input;
for (i = 0; i <= Object.keys(data).length; i += 1) { // if there are previously stored data in input for this sprSheet
if (Object.keys(data)[i] === options.action) { if (result.input[gadget.props.name]) {
content = data[options.action].configuration.columns; content = result.input[gadget.props.name];
} else {
// otherwise use the clean configuration
for (i = 0; i <= Object.keys(config).length; i += 1) {
if (Object.keys(config)[i] === options.action) {
content = config[options.action].configuration.columns;
}
} }
} }
// application_configuration.input.view_???_spreasheet.configuration // application_configuration.input.view_???_spreasheet.configuration
......
...@@ -6,11 +6,20 @@ ...@@ -6,11 +6,20 @@
rJS(window) rJS(window)
.declareMethod('render', function (content, options) { .declareMethod('render', function (content, options) {
var data = JSON.parse(content), var data = JSON.parse(content),
i, def = []; i, ctrlflag = true, def = [];
// if the content is not an array of arrays then create one
// from the content
for (i = 0; i <= data.length-1; i += 1) { for (i = 0; i <= data.length-1; i += 1) {
def.push(data[i].name); if (!(data[i].constructor === Array)) {
def.push(data[i].name);
} else {
// otherwise do not modify anything
def = data;
ctrlflag = false;
break;
}
} }
def = [def]; if (ctrlflag) { def = [def]; }
return this.getElement() return this.getElement()
.push(function (element) { .push(function (element) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment