mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-06 06:56:54 +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 + '"' +
|
||||
'>' + generateColumnNameTooltip(data.name) + '</th>');
|
||||
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
|
||||
// new table
|
||||
$('#samples').off();
|
||||
|
|
|
@ -12,6 +12,7 @@ class SamplesTable < ActiveRecord::Base
|
|||
organization: custom_field.organization)
|
||||
org_status = samples_table.first['status']
|
||||
if column_index
|
||||
# delete column
|
||||
org_status['columns'].delete(column_index)
|
||||
org_status['columns'].keys.each do |index|
|
||||
p index
|
||||
|
@ -31,10 +32,11 @@ class SamplesTable < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
else
|
||||
# add column
|
||||
index = org_status['columns'].count
|
||||
org_status['columns'][index] = SampleDatatable::
|
||||
SAMPLES_TABLE_DEFAULT_STATE['columns'].first
|
||||
org_status['ColReorder'] << index.to_s
|
||||
org_status['ColReorder'].insert(2, index)
|
||||
end
|
||||
samples_table.first.update(status: org_status)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue