mercredi 10 mai 2017

Checkbox Checked state in Datatables

The code snippets below shows my JSON string and the makeup of my table. the checkbox data when returned is not changing the checkbox checked state, any idea why? since the data is 1 for all of the 3 records, the checkbox should have checked state.

I tired to do something like this but did not work,

return '<input type="checkbox value="' + data +' >';

 var tablenest = $('#RegSrc').DataTable({
                select: true,
                "bPaginate": false,
                "bFilter": false,
                responsive: true,
                deferRender: true,
                "processing": true,
                "serverSide": false,
                bAutoWidth: true,
                data:[{"PrtFilenum":13090701,"Fullname":" sadden ","PrtStatus":1},{"PrtFilenum":15120996,"Fullname":"marwam mohmmad saleem","PrtStatus":1},{"PrtFilenum":170227111,"Fullname":"asd dsf a","PrtStatus":1}],

                columns: [
                  { "width": "20%", data: "PrtFilenum" },
                   { "width": "50%", data: "Fullname" },
                   {
                       "width": "30%",
                       data:   "PrtStatus",
                       render: function ( data, type, row ) {
                           if ( type === 'display' ) {
                               return '<input type="checkbox">';
                           }
                           return data;
                       },
                       className: "dt-body-center"
                   }
                   
                ],
            });
<link href="http://ift.tt/2pj6mAc" rel="stylesheet" />
<link href="http://ift.tt/2apRjw3" rel="stylesheet" />
<script src="http://ift.tt/1oMJErh"></script>
<script src="http://ift.tt/2pNFBT5"></script>
<script src="http://ift.tt/2pj6kIA"></script>
<script src="http://ift.tt/2qYTmfn"></script>
<link href="http://ift.tt/2pj1ZVE" rel="stylesheet" />

  <table id="RegSrc" class="table table-bordered table-striped table-condensed mb-none">
                                <thead>
                                    <tr>
                                        <th><b>File Number</b></th>
                                        <th><b>Patient Name</b></th>
                                        <th><b>Status</b></th>
                                    </tr>
                                </thead>
                                <tbody>
                                </tbody>
                            </table>



Aucun commentaire:

Enregistrer un commentaire