Fix protocol templates rows selection flickering [SCI-8105] (#5185)

* Fix protocol templates rows selection flickering [SCI-8105]

* Fix double initialization of row selection [SCI-8105]
This commit is contained in:
ajugo 2023-03-23 13:40:21 +01:00 committed by GitHub
parent 7ef2f68078
commit e065098082
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View file

@ -239,7 +239,6 @@ var ProtocolsIndex = (function() {
},
fnDrawCallback: function() {
animateSpinner(this, false);
initRowSelection();
},
preDrawCallback: function() {
animateSpinner(this);
@ -267,6 +266,7 @@ var ProtocolsIndex = (function() {
initLocalFileImport();
initProtocolsFilters();
initRowSelection();
},
stateLoadCallback: function() {
// Load the table state for the current team
@ -309,8 +309,10 @@ var ProtocolsIndex = (function() {
let protocolsTableScrollHead = protocolsTableEl.closest('.dataTables_scroll').find('.dataTables_scrollHead');
// Handle click on table cells with checkboxes
protocolsTableEl.on('click', 'tbody td, thead th:first-child', function() {
$(this).parent().find("input[type='checkbox']").trigger('click');
protocolsTableEl.on('click', 'tbody td, thead th:first-child', function(ev) {
if (ev.target === ev.currentTarget) {
$(this).parent().find("input[type='checkbox']").trigger('click');
}
});
// Handle clicks on checkbox

View file

@ -219,7 +219,7 @@ class ProtocolsDatatable < CustomDatatable
def keywords_html(record)
if record.protocol_keywords.blank?
"<i>#{I18n.t('protocols.no_keywords')}</i>"
I18n.t('protocols.no_keywords')
else
res = []
record.protocol_keywords.sort_by { |kw| kw.name.downcase }.each do |kw|