In one Browse view, I created an extra column with a check in Javascript/jQuery. All in all, it works fine, but there is a problem with ticking the checkbox; sometimes, it needs two or three quick clicks to get it activated, usually the same with deactivating the box. I got the impression, the checkbox sind not implemented properly and some elements/functions are in conflict with the checkbox.
Here are the codes from the Custom Code field:
Code: Select all
if (nuFormType() == 'browse') {
addCheckbox();
}
function nuSelectBrowse(element) {
const col = $(element.target).attr('data-nu-column');
if (col !== '0' && typeof col !== "undefined") {
const primaryKey = $(element).attr('data-nu-primary-key');
nuForm(nuFormId(), primaryKey, '', '', '1');
} else {
return false;
}
}
function addCheckbox() {
$("[data-nu-column='0']").each(function(index) {
let pk = $(this).attr('data-nu-primary-key');
if (typeof pk !== "undefined") {
let checked = $(this).html() == '1' ? 'checked="checked"': '';
$(this).html('<input type="checkbox" ' + checked + ' id="' + pk + '" name="mycheckbox[]">')}
});
}