Page 1 of 1
Show Checkbox in ListView
Posted: Tue Nov 30, 2021 5:39 pm
by oli
Hi,
I couldn't find a solution to show Checkboxes in the Listview.
Is this possible somehow in the current Version of nuBuilder?
BR, Oli
Re: Show Checkbox in ListView
Posted: Tue Nov 30, 2021 6:00 pm
by kev1n
Hi,
What is the purpose of the checkboxes? As replacement for 0,1 values or something else?
Re: Show Checkbox in ListView
Posted: Tue Nov 30, 2021 6:19 pm
by oli
Yes, exactly.
It should only replace 1 or 0 (and NULL) values.
Re: Show Checkbox in ListView
Posted: Tue Nov 30, 2021 7:54 pm
by kev1n
To add checkboxes in the first column (index 0):
Code: Select all
$("[data-nu-column='0']").each(function(index) {
let pk = $(this).attr('data-nu-primary-key');
let checked = $(this).html() == '1' ? 'checked="checked"' : '';
$(this).html('<input type="checkbox" ' + checked + ' id="' + pk + '" name="mycheckbox[]" onclick=";">')
});