mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-29 11:45:18 +08:00
Fix plate template JSON creation [SCI-8082]
This commit is contained in:
parent
a33707bd5e
commit
97bde133a8
4 changed files with 7 additions and 11 deletions
|
@ -11,13 +11,12 @@
|
|||
var contents = $(this).find('.hot-contents');
|
||||
var metadataJson = $(this).find('.hot-metadata');
|
||||
var metadata = JSON.parse(metadataJson.val() || '{}');
|
||||
var isPlateTemplate = metadata.plateTemplate === 'true';
|
||||
|
||||
$container.handsontable({
|
||||
startRows: HANDSONTABLE_INIT_ROWS_CNT,
|
||||
startCols: HANDSONTABLE_INIT_COLS_CNT,
|
||||
rowHeaders: tableColRowName.tableRowHeaders(isPlateTemplate),
|
||||
colHeaders: tableColRowName.tableColHeaders(isPlateTemplate),
|
||||
rowHeaders: tableColRowName.tableRowHeaders(metadata.plateTemplate),
|
||||
colHeaders: tableColRowName.tableColHeaders(metadata.plateTemplate),
|
||||
fillHandle: false,
|
||||
formulas: true,
|
||||
data: JSON.parse(contents.attr('value')).data,
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
var parentEl;
|
||||
var order;
|
||||
var metadata;
|
||||
var isPlateTemplate;
|
||||
|
||||
// Special handling if this is a repository table
|
||||
if (input.hasClass('hot-repository-items')) {
|
||||
|
@ -66,11 +65,10 @@
|
|||
el.handsontable('getInstance').getPlugin('columnSorting').sort(3, order);
|
||||
} else {
|
||||
metadata = JSON.parse(metadataJson.val() || '{}');
|
||||
isPlateTemplate = metadata.plateTemplate === 'true';
|
||||
el.handsontable({
|
||||
disableVisualSelection: true,
|
||||
rowHeaders: tableRowHeaders(isPlateTemplate),
|
||||
colHeaders: tableColHeaders(isPlateTemplate),
|
||||
rowHeaders: tableRowHeaders(metadata.plateTemplate),
|
||||
colHeaders: tableColHeaders(metadata.plateTemplate),
|
||||
editor: false,
|
||||
copyPaste: false,
|
||||
formulas: true,
|
||||
|
|
|
@ -18,7 +18,7 @@ module StepElements
|
|||
name: name,
|
||||
contents: { data: Array.new(predefined_table_dimensions[0],
|
||||
Array.new(predefined_table_dimensions[1], '')) }.to_json,
|
||||
metadata: { plateTemplate: create_table_params[:plateTemplate] },
|
||||
metadata: { plateTemplate: create_table_params[:plateTemplate] == 'true' },
|
||||
created_by: current_user,
|
||||
team: @step.protocol.team
|
||||
))
|
||||
|
|
|
@ -181,15 +181,14 @@
|
|||
let container = this.$refs.hotTable;
|
||||
let data = JSON.parse(this.element.attributes.orderable.contents);
|
||||
let metadata = this.element.attributes.orderable.metadata || {};
|
||||
let isPlateTemplate = metadata.plateTemplate === 'true';
|
||||
|
||||
this.tableObject = new Handsontable(container, {
|
||||
data: data.data,
|
||||
width: '100%',
|
||||
startRows: 5,
|
||||
startCols: 5,
|
||||
rowHeaders: tableColRowName.tableRowHeaders(isPlateTemplate),
|
||||
colHeaders: tableColRowName.tableColHeaders(isPlateTemplate),
|
||||
rowHeaders: tableColRowName.tableRowHeaders(metadata.plateTemplate),
|
||||
colHeaders: tableColRowName.tableColHeaders(metadata.plateTemplate),
|
||||
cell: metadata.cells || [],
|
||||
contextMenu: this.editingTable,
|
||||
formulas: true,
|
||||
|
|
Loading…
Reference in a new issue