mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-06 15:05:26 +08:00
Merge pull request #354 from mlorb/ml-sci-786
Add new column on first position in sample tables [SCI-786]
This commit is contained in:
commit
7e5d748fc1
2 changed files with 4 additions and 2 deletions
|
@ -866,7 +866,7 @@ function changeToEditMode() {
|
||||||
'data-destroy-html-url="' + data.destroy_html_url + '"' +
|
'data-destroy-html-url="' + data.destroy_html_url + '"' +
|
||||||
'>' + generateColumnNameTooltip(data.name) + '</th>');
|
'>' + generateColumnNameTooltip(data.name) + '</th>');
|
||||||
var colOrder = table.colReorder.order();
|
var colOrder = table.colReorder.order();
|
||||||
colOrder.push(colOrder.length);
|
colOrder.splice(2, 0, colOrder.length);
|
||||||
// Remove all event handlers as we re-initialize them later with
|
// Remove all event handlers as we re-initialize them later with
|
||||||
// new table
|
// new table
|
||||||
$('#samples').off();
|
$('#samples').off();
|
||||||
|
|
|
@ -12,6 +12,7 @@ class SamplesTable < ActiveRecord::Base
|
||||||
organization: custom_field.organization)
|
organization: custom_field.organization)
|
||||||
org_status = samples_table.first['status']
|
org_status = samples_table.first['status']
|
||||||
if column_index
|
if column_index
|
||||||
|
# delete column
|
||||||
org_status['columns'].delete(column_index)
|
org_status['columns'].delete(column_index)
|
||||||
org_status['columns'].keys.each do |index|
|
org_status['columns'].keys.each do |index|
|
||||||
p index
|
p index
|
||||||
|
@ -31,10 +32,11 @@ class SamplesTable < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
# add column
|
||||||
index = org_status['columns'].count
|
index = org_status['columns'].count
|
||||||
org_status['columns'][index] = SampleDatatable::
|
org_status['columns'][index] = SampleDatatable::
|
||||||
SAMPLES_TABLE_DEFAULT_STATE['columns'].first
|
SAMPLES_TABLE_DEFAULT_STATE['columns'].first
|
||||||
org_status['ColReorder'] << index.to_s
|
org_status['ColReorder'].insert(2, index)
|
||||||
end
|
end
|
||||||
samples_table.first.update(status: org_status)
|
samples_table.first.update(status: org_status)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue