Request Requested unknown parameter '' for row 0, column 0.

Request Requested unknown parameter '' for row 0, column 0.

bricoreurbricoreur Posts: 2Questions: 1Answers: 0

Hello,
I am working with the symfony and webpack framework.

In my controller, I get my data in a variable that I transform into json. here is the rendering:

$players = json_encode($players);
var_dump($players); 

**output ($players)**

[{"id":"51","user_id":"89","departement_id":"13","licence":null,"nom":"JOUEURA","prenom":"JOUAA","sexe":"homme"}]

My template is the next :

 <table id="Contacts" class="table table-striped table-bordered responsive" >
                <thead>
                    <tr>
                        <th></th>                                                                                                                <!-- 0. responsive -->
                        <th style="display:none"><input type="checkbox" id="check-all-button"/></th>    <!-- 1. checkbox-->   
                        <th style="max-width:10%">PHOTO</th>                                                              <!-- 2. photo --> 
                        <th >NOM</th>                                                                                                       <!-- 3. nom -->
                        <th>PRENOM</th>                                                                                                <!-- 4. prenom -->
                        <th>GENRE</th>                                                                                                   <!-- 5. genre -->        
                        <th></th>                  
                    </tr>
                </thead>
            </table>

script DATATABLES

 $('#Contacts').DataTable({
        data: $players,
        rowId: 'id',
        responsive: true,
        paging: false,
        info: false,
        dom: 'Bfrtip',
        scrollY: "54vh",
        scrollX: true,
        scrollCollapse: true,
        buttons: [
            {
                extend: 'colvis', // affiche le bouton de visibilité
                attr: {
                    type: 'button'
                },
                className: 'btn btn-primary waves-effect waves-light',
                text: "Choix des colonnes",
                columns: ":not(.noShowClovis)",
                postfixButtons: ['colvisRestore'] // restore toutes les visibilités
            }
        ],
        columns: [
            { data: ' ' }, ** // responsive => pb**
            { data: ' ' },  **// select All => pb**
            { data: ' ' },  **// photo => pb**
            { data: 'nom' },
            { data: 'prenom' },
            { data: 'sexe' },
            { data: ' ' },  **// update=> pb**
        ],
        aoColumnDefs: [
            {
                'className': "noShowClovis", 
                'targets': 0,
                'bSortable': false,
                'mData': null,
                "mRender": function (data, type, full) {
                    return '';
                },
            },
            {
                'className': "noShowClovis",
                'targets': 1,
                'bSortable': false,
                'mData': null,
                "mRender": function (data, type, full) {
                    return '<input id="' + full.id + '" type="checkbox" class="select_checkbox" name="ids[]" value="' + full.id + '" >';
                },
            },
            {
                'targets': 2,
                'bSortable': false,
                'mData': null,
                "mRender": function (data, type, full) {
                    if (full.photo_file_name == "") {
                        return `<img src="/build/images/PasDePhoto.002e050a.png" />`;
                    } else {
                        return '<img src="/uploads/photos/' + full.photo_file_name + '" />';
                    }
                },
            },
            {
                // nom
                'className': "noShowClovis",
                'targets': 3
            },
            {
                // prenom
                'className': "noShowClovis",
                'targets': 4,
                'bSortable': false
            },
            {
                // sexe
                'className': "noShowClovis",
                'targets': 5,
            },
            {
                'className': "noShowClovis",
                'targets': 6,
                'bSortable': false,
                'mData': null,
                "mRender": function (data, type, full) {
                        return "<button type='button' class='modif btn' data-id='" + full.player_id + "' data-toggle='modal' data- 
                                   target='#formUpdateUserPlayer'> UPDATE</button>"
               }
            }
        ]
    });

i think this is coming from data fields which have no values? Do you have a solution or idea to resolve my error message?

DataTables warning: table id=mesContacts - Requested unknown parameter '' for row 0, column 0.

I read : DataTables warning: table id={id} - Requested unknown parameter '{parameter}' for row {row-index}, column{column-index}`

Answers

This discussion has been closed.