how to complete checkbox with JSON from PHP?

how to complete checkbox with JSON from PHP?

cris_mfcris_mf Posts: 5Questions: 2Answers: 0
edited December 2017 in Free community support

Hi!!
I make the checkbox adding this code in columnDefs.

{   
'targets': 7,
 'searchable':false,
 'orderable':false,
 'className': 'dt-body-center',
 'render': function (data, type, full, meta){
         return '<input type="checkbox" name="id[]" value="'   + $('<div/>').text(data).html() + '">';
                                             
    }
}

Now I try complete the checkbox with data from PHP in JSON. In console I can see that parametre 'full' contains all de data but I can´t manipulate it. I need to compare what is the value of JSON for mark each checkbox.

Sorry for my english and I waitting for a response :)

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,457Questions: 1Answers: 10,465 Site admin
    Answer ✓

    What is the logic condition that you need to use? Something like checked="'+(full.checked ? 'checked' : '') + '"' should do it.

    Allan

  • cris_mfcris_mf Posts: 5Questions: 2Answers: 0

    Hi Allan,
    Thanks so much!!!! I was not sure with de sintaxis, the checkbox are working!

This discussion has been closed.