jquery-datatables-checkboxes icon indicating copy to clipboard operation
jquery-datatables-checkboxes copied to clipboard

Missing checkbox checked status when checkboxes are rendered

Open WillYouth opened this issue 3 years ago • 2 comments

Hi I wish to know how can I get my checkbox status when rendered checkboxes in table. I already create the table using html with checkbox status. But after initialize using this plugin, the checkbox status are all cleared.

Before: <input type="checkbox" name="items[]" checked="" value="312"> After: <input type="checkbox" class="dt-checkboxes" autocomplete="off">

Thanks a lot for the help

WillYouth avatar Dec 20 '21 03:12 WillYouth

@exptom or @mpryvkin can help with this issue? Thanks!

WillYouth avatar Dec 23 '21 02:12 WillYouth

you can add selectCallback to your tabel. Something like this

                     checkboxes: {
                            selectRow: true,
                            selectCallback: function(nodes, selected){
                                console.log(nodes);
                                if(selected) {
                                    $('input[type="checkbox"]', nodes).prop('checked', true);
                                } else {
                                    $('input[type="checkbox"]', nodes).prop('checked', false);
                                }
                            }
                        }
                        

halali avatar Mar 03 '22 11:03 halali