diff --git a/app/assets/javascripts/repositories/renderers/view_renderers.js b/app/assets/javascripts/repositories/renderers/view_renderers.js index 4fb81f556..2ee3595b9 100644 --- a/app/assets/javascripts/repositories/renderers/view_renderers.js +++ b/app/assets/javascripts/repositories/renderers/view_renderers.js @@ -1,3 +1,4 @@ + $.fn.dataTable.render.RepositoryAssetValue = function(data) { var asset = data.data; return ` @@ -14,11 +15,22 @@ $.fn.dataTable.render.RepositoryAssetValue = function(data) { `; }; +$.fn.dataTable.render.defaultRepositoryAssetValue = function() { + return ''; +}; $.fn.dataTable.render.RepositoryTextValue = function(data) { return data.data; }; +$.fn.dataTable.render.defaultRepositoryTextValue = function() { + return ''; +}; + $.fn.dataTable.render.RepositoryListValue = function(data) { return data.data; }; + +$.fn.dataTable.render.defaultRepositoryListValue = function() { + return ''; +}; diff --git a/app/assets/javascripts/repositories/repository_datatable.js b/app/assets/javascripts/repositories/repository_datatable.js index a55d798d2..f337263c3 100644 --- a/app/assets/javascripts/repositories/repository_datatable.js +++ b/app/assets/javascripts/repositories/repository_datatable.js @@ -531,16 +531,20 @@ var RepositoryDatatable = (function(global) { }, order: $(TABLE_ID).data('default-order'), columns: (function() { - var numOfColumns = $(TABLE_ID).data('num-columns'); var columns = $(TABLE_ID).data('default-table-columns'); - for (let i = 0; i < numOfColumns; i += 1) { - if (columns[i] === undefined) { - // This should only occur for custom columns - columns[i] = { visible: true, searchable: true }; - } + var customColumns = $(TABLE_ID).find('thead th[data-type]'); + for (let i = 0; i < columns; i += 1) { columns[i].data = String(i); columns[i].defaultContent = ''; } + customColumns.each((i, column) => { + columns.push({ + visible: true, + searchable: true, + data: String(columns.length), + defaultContent: $.fn.dataTable.render['default' + column.dataset.type](column.id) + }); + }); return columns; }()), fnDrawCallback: function() {