Add default renders for new columns type

This commit is contained in:
aignatov-bio 2019-10-28 14:52:46 +01:00 committed by Urban Rotnik
parent 232e4d78be
commit c6a075664c
2 changed files with 22 additions and 6 deletions

View file

@ -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 '';
};

View file

@ -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() {