diff --git a/app/assets/javascripts/repositories/repository_datatable.js.erb b/app/assets/javascripts/repositories/repository_datatable.js.erb index 382f3e729..a054459ee 100644 --- a/app/assets/javascripts/repositories/repository_datatable.js.erb +++ b/app/assets/javascripts/repositories/repository_datatable.js.erb @@ -400,13 +400,7 @@ var RepositoryDatatable = (function(global) { dataType: 'json', success: function(data) { var columns_ids = data.columns; - var present_columns = []; - $('table' + TABLE_ID + ' thead tr').children('th').each(function() { - var id = parseInt($(this).attr('id')); - if(id) { - present_columns.push(id); - } - }); + var present_columns = $(TABLE_ID).data('repository-columns-ids'); if( !_.isEqual(columns_ids.sort(), present_columns.sort()) ) { alert($(TABLE_ID).data('columns-changed')); animateSpinner(); diff --git a/app/views/repositories/_repository_table.html.erb b/app/views/repositories/_repository_table.html.erb index 98f8f24aa..ba7a9e3a7 100644 --- a/app/views/repositories/_repository_table.html.erb +++ b/app/views/repositories/_repository_table.html.erb @@ -8,6 +8,7 @@ data-delete-record="<%= repository_delete_records_path(repository) %>" data-copy-records="<%= repository_copy_records_path(repository) %>" data-max-dropdown-length="<%= Constants::NAME_TRUNCATION_LENGTH_DROPDOWN %>" + data-repository-columns-ids="<%= repository.available_columns_ids %>" data-save-text="<%= I18n.t('general.save') %>" data-edit-text="<%= I18n.t('general.edit') %>" data-cancel-text="<%= I18n.t('general.cancel') %>"