Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Show Checkbox in ListView

Questions related to using nuBuilder Forte.
Post Reply
oli
Posts: 118
Joined: Sat Mar 20, 2021 3:22 pm
Has thanked: 4 times

Show Checkbox in ListView

Unread post 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
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Show Checkbox in ListView

Unread post by kev1n »

Hi,

What is the purpose of the checkboxes? As replacement for 0,1 values or something else?
oli
Posts: 118
Joined: Sat Mar 20, 2021 3:22 pm
Has thanked: 4 times

Re: Show Checkbox in ListView

Unread post by oli »

Yes, exactly.
It should only replace 1 or 0 (and NULL) values.
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Show Checkbox in ListView

Unread post 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=";">')
 });
Post Reply