mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-27 10:14:17 +08:00
Fix for hidden columns
This commit is contained in:
parent
3a76753b72
commit
d797469e38
2 changed files with 33 additions and 31 deletions
|
@ -145,19 +145,19 @@ var RepositoryDatatable = (function(global) {
|
|||
}
|
||||
|
||||
// Helper functions
|
||||
function listItemDropdown(options, currentValue, columnId) {
|
||||
var html = `<select class="form-control selectpicker repository-dropdown"
|
||||
data-abs-min-length="2" data-live-search="true"
|
||||
data-container="body" column_id="${columnId}">
|
||||
<option value="-1"></option>`;
|
||||
$.each(options, function(index, value) {
|
||||
var selected = (currentValue === value[1]) ? 'selected' : '';
|
||||
html += '<option value="' + value[0] + '" ' + selected + '>';
|
||||
html += value[1] + '</option>';
|
||||
});
|
||||
html += '</select>';
|
||||
return html;
|
||||
}
|
||||
// function listItemDropdown(options, currentValue, columnId) {
|
||||
// var html = `<select class="form-control selectpicker repository-dropdown"
|
||||
// data-abs-min-length="2" data-live-search="true"
|
||||
// data-container="body" column_id="${columnId}">
|
||||
// <option value="-1"></option>`;
|
||||
// $.each(options, function(index, value) {
|
||||
// var selected = (currentValue === value[1]) ? 'selected' : '';
|
||||
// html += '<option value="' + value[0] + '" ' + selected + '>';
|
||||
// html += value[1] + '</option>';
|
||||
// });
|
||||
// html += '</select>';
|
||||
// return html;
|
||||
// }
|
||||
|
||||
function initRowSelection() {
|
||||
// Handle clicks on checkbox
|
||||
|
@ -401,24 +401,24 @@ var RepositoryDatatable = (function(global) {
|
|||
});
|
||||
}
|
||||
|
||||
function initialListItemsRequest(columnId) {
|
||||
var massageResponse = [];
|
||||
$.ajax({
|
||||
url: $(TABLE_ID).data('list-items-path'),
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
async: false,
|
||||
data: {
|
||||
q: '',
|
||||
column_id: columnId
|
||||
}
|
||||
}).done(function(data) {
|
||||
$.each(data.list_items, function(index, el) {
|
||||
massageResponse.push([el.id, el.data]);
|
||||
});
|
||||
});
|
||||
return listItemDropdown(massageResponse, '-1', columnId);
|
||||
}
|
||||
// function initialListItemsRequest(columnId) {
|
||||
// var massageResponse = [];
|
||||
// $.ajax({
|
||||
// url: $(TABLE_ID).data('list-items-path'),
|
||||
// type: 'POST',
|
||||
// dataType: 'json',
|
||||
// async: false,
|
||||
// data: {
|
||||
// q: '',
|
||||
// column_id: columnId
|
||||
// }
|
||||
// }).done(function(data) {
|
||||
// $.each(data.list_items, function(index, el) {
|
||||
// massageResponse.push([el.id, el.data]);
|
||||
// });
|
||||
// });
|
||||
// return listItemDropdown(massageResponse, '-1', columnId);
|
||||
// }
|
||||
|
||||
function initSelectPicker() {
|
||||
$('.selectpicker')
|
||||
|
|
|
@ -127,6 +127,8 @@ var RepositoryDatatableRowEditor = (function() {
|
|||
let dataType = $header.data('type');
|
||||
let cell = this;
|
||||
|
||||
if (!cell.column(cell.index().column).visible()) return true; // return if cell is not visible
|
||||
|
||||
if (columnId === NAME_COLUMN_ID) {
|
||||
$.fn.dataTable.render.editRowName(formId, cell);
|
||||
} else if (dataType) {
|
||||
|
|
Loading…
Reference in a new issue