Welcome to the nuBuilder Forums!

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

browse display checkboxes

Questions related to using nuBuilder Forte.
Locked
Timo
Posts: 217
Joined: Thu Mar 15, 2018 9:26 pm
Has thanked: 1 time

browse display checkboxes

Unread post by Timo »

A browse form shows 0 or 1 for TINYINT(1), BOOLEAN db fields. Checkboxes like ☑ / ☐ would look nicer. Is there an easy way to do this?
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: browse display checkboxes

Unread post by admin »

Timo,

Try this - (place it in the Javascript of the Browse Form you want to change).

Code: Select all


    $("[data-nu-column='1']").each(function(index) {
        
        if($( this ).html() == '1'){
            $( this ).html('<input type="checkbox" checked>') 
        }else{
            
            if($( this ).html() != ''){
                $( this ).html('<input type="checkbox">') 
            }
            
        }

    });
    
Steven
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: browse display checkboxes

Unread post by toms »

I made just a small improvement to this code so that checkboxes are not clickable but appear still enabled (not grayed out)

Code: Select all

    $("[data-nu-column='1']").each(function(index) {

        if ($(this).html() == '1') {
            $(this).html('<input type="checkbox"  checked onclick="this.checked=!this.checked;" >')
        } else {

            if ($(this).html() != '') {
                $(this).html('<input type="checkbox"  onclick="this.checked=!this.checked;">')
            }

        }

    });
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: browse display checkboxes

Unread post by admin »

.
Locked