Commit 2c685719 authored by Jérome Perrin's avatar Jérome Perrin

Input_viewSpreadsheet: allow to configure handsontable_options in action definition

parent 3474904a
/*global rJS, RSVP, initGadgetMixin, loopEventListener */
(function (window, rJS, RSVP, initGadgetMixin, loopEventListener) {
/*global rJS, RSVP, initGadgetMixin, loopEventListener, $ */
(function (window, rJS, RSVP, initGadgetMixin, loopEventListener, $) {
"use strict";
function saveSpreadsheet(evt) {
......@@ -78,8 +78,6 @@
if (options.action_definition.configuration.input_id){
gadget.props.name = options.action_definition.configuration.input_id;
}
gadget.props.configuration = options.action_definition.configuration;
return new RSVP.Queue()
.push(function () {
return RSVP.all([
......@@ -92,18 +90,9 @@
})
.push(function (result_list) {
var content,
result = JSON.parse(result_list[0]);
// if there are previously stored data in input for this sprSheet
if (result.input[gadget.props.name]) {
content = result.input[gadget.props.name];
} else {
content = options.action_definition.configuration.columns;
}
// application_configuration.input.view_???_spreasheet.configuration
return result_list[1].render(
JSON.stringify(content),
{ minSpareRows: 1,
result = JSON.parse(result_list[0]),
handsontable_options = {
minSpareRows: 1,
onChange: function () {
if (gadget.timeout) {
window.clearTimeout(gadget.timeout);
......@@ -113,7 +102,18 @@
100
);
}
}
};
// if there are previously stored data in input for this sprSheet
if (result.input[gadget.props.name]) {
content = result.input[gadget.props.name];
} else {
content = options.action_definition.configuration.columns;
}
$.extend(handsontable_options, options.action_definition.configuration.handsontable_options || {});
return result_list[1].render(
JSON.stringify(content),
handsontable_options
);
});
})
......@@ -128,4 +128,4 @@
]);
});
});
}(window, rJS, RSVP, initGadgetMixin, loopEventListener));
}(window, rJS, RSVP, initGadgetMixin, loopEventListener, $));
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